From 2aa5162fc9d5db6bf2c71efe308662cf855d28f5 Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Tue, 2 Jun 2026 13:02:06 +0500 Subject: [PATCH] web: set edited date as max date in note creation date edit's day picker (#9924) * web: set edited date as max date in note creation date edit's day picker Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> * web: fix creation date not being able to set to same as edited date Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- .../src/dialogs/edit-note-creation-date-dialog.tsx | 11 ++++------- packages/intl/locale/en.po | 4 ++++ packages/intl/locale/pseudo-LOCALE.po | 4 ++++ packages/intl/src/strings.ts | 4 +++- 4 files changed, 15 insertions(+), 8 deletions(-) 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` };