diff --git a/apps/web/src/dialogs/edit-note-creation-date-dialog.tsx b/apps/web/src/dialogs/edit-note-creation-date-dialog.tsx index d73e76dd0..1a85ef215 100644 --- a/apps/web/src/dialogs/edit-note-creation-date-dialog.tsx +++ b/apps/web/src/dialogs/edit-note-creation-date-dialog.tsx @@ -65,6 +65,7 @@ export const EditNoteCreationDateDialog = DialogManager.register( onClose(false); }} title={strings.editCreationDate()} + description={`${strings.note()}: ${strings.creationDateCannotBeAfterLastEditedDate()}`} negativeButton={{ text: strings.cancel(), onClick: () => { @@ -76,14 +77,10 @@ export const EditNoteCreationDateDialog = DialogManager.register( text: strings.save(), onClick: async () => { try { - if (date.isAfter(dayjs())) { - showToast("error", "Creation date cannot be in the future"); - return; - } - if (dateEdited && date.isAfter(dayjs(dateEdited))) { + if (dateEdited && date.isAfter(dayjs(dateEdited), "minute")) { showToast( "error", - "Creation date cannot be after last edited date" + strings.creationDateCannotBeAfterLastEditedDate() ); return; } @@ -140,7 +137,7 @@ export const EditNoteCreationDateDialog = DialogManager.register( width: 300 }} selected={dayjs(date).toDate()} - maxDate={new Date()} + maxDate={new Date(dateEdited)} onSelect={(day) => { if (!day) return; const date = getFormattedDate(day, "date"); diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po index a1beee984..d23114893 100644 --- a/packages/intl/locale/en.po +++ b/packages/intl/locale/en.po @@ -1973,6 +1973,10 @@ msgstr "Created at" msgid "Creating a{0} backup" msgstr "Creating a{0} backup" +#: src/strings.ts:2695 +msgid "Creation date cannot be after last edited date" +msgstr "Creation date cannot be after last edited date" + #: src/strings.ts:2049 msgid "Credentials" msgstr "Credentials" diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po index 564938bd0..87ace840f 100644 --- a/packages/intl/locale/pseudo-LOCALE.po +++ b/packages/intl/locale/pseudo-LOCALE.po @@ -1962,6 +1962,10 @@ msgstr "" msgid "Creating a{0} backup" msgstr "" +#: src/strings.ts:2695 +msgid "Creation date cannot be after last edited date" +msgstr "" + #: src/strings.ts:2049 msgid "Credentials" msgstr "" diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts index 7b52d74a2..11ffb5744 100644 --- a/packages/intl/src/strings.ts +++ b/packages/intl/src/strings.ts @@ -2690,5 +2690,7 @@ Continue without attachments?`, expiryDateMustBeInTheFuture: () => t`Expiry date must be in the future`, expiryDateCannotBeMoreThan1YearInTheFuture: () => t`Expiry date cannot be more than 1 year in the future`, - expiryDateSet: () => t`Expiry date set` + expiryDateSet: () => t`Expiry date set`, + creationDateCannotBeAfterLastEditedDate: () => + t`Creation date cannot be after last edited date` };