Compare commits

...

1 Commits

Author SHA1 Message Date
700fa23787 fix: document creation timezone 2024-07-23 15:15:29 +03:00

View File

@ -98,9 +98,13 @@ export const AddSettingsFormPartial = ({
// We almost always want to set the timezone to the user's local timezone to avoid confusion // We almost always want to set the timezone to the user's local timezone to avoid confusion
// when the document is signed. // when the document is signed.
useEffect(() => { useEffect(() => {
if (!form.formState.touchedFields.meta?.timezone && !documentHasBeenSent) { // Check if the timezone field has not been modified and the document hasn't been sent
if (!form.formState.dirtyFields.meta?.timezone && !documentHasBeenSent) {
// If the timezone is the default timezone, set it to the user's local timezone automatically
if (form.getValues('meta.timezone') === DEFAULT_DOCUMENT_TIME_ZONE) {
form.setValue('meta.timezone', Intl.DateTimeFormat().resolvedOptions().timeZone); form.setValue('meta.timezone', Intl.DateTimeFormat().resolvedOptions().timeZone);
} }
}
}, [documentHasBeenSent, form, form.setValue, form.formState.touchedFields.meta?.timezone]); }, [documentHasBeenSent, form, form.setValue, form.formState.touchedFields.meta?.timezone]);
return ( return (