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,8 +98,12 @@ 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
|
||||||
form.setValue('meta.timezone', Intl.DateTimeFormat().resolvedOptions().timeZone);
|
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]);
|
}, [documentHasBeenSent, form, form.setValue, form.formState.touchedFields.meta?.timezone]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user