mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 17:21:41 +10:00
fix: document creation timezone
This commit is contained in:
@ -98,9 +98,13 @@ export const AddSettingsFormPartial = ({
|
||||
// We almost always want to set the timezone to the user's local timezone to avoid confusion
|
||||
// when the document is signed.
|
||||
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);
|
||||
}
|
||||
}
|
||||
}, [documentHasBeenSent, form, form.setValue, form.formState.touchedFields.meta?.timezone]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user