diff --git a/apps/web/src/dialogs/note-expiry-date-dialog.tsx b/apps/web/src/dialogs/note-expiry-date-dialog.tsx index 42173b28b..01ae5604d 100644 --- a/apps/web/src/dialogs/note-expiry-date-dialog.tsx +++ b/apps/web/src/dialogs/note-expiry-date-dialog.tsx @@ -54,19 +54,26 @@ export const NoteExpiryDateDialog = DialogManager.register( return ( onClose(false)} width={400} positiveButton={{ text: strings.done(), onClick: async () => { if (date.isBefore(dayjs())) { - showToast("error", "Expiry date must be in the future"); + showToast("error", strings.expiryDateMustBeInTheFuture()); + return; + } + if (date.isAfter(dayjs().add(1, "year"))) { + showToast( + "error", + strings.expiryDateCannotBeMoreThan1YearInTheFuture() + ); return; } await db.notes.setExpiryDate(date.valueOf(), noteId); store.refresh(); - showToast("success", "Expiry date set"); + showToast("success", strings.expiryDateSet()); onClose(true); } }} diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po index 39ba48777..a1beee984 100644 --- a/packages/intl/locale/en.po +++ b/packages/intl/locale/en.po @@ -2767,6 +2767,18 @@ msgstr "Experience the next level of private note taking\"" msgid "Expiry date" msgstr "Expiry date" +#: src/strings.ts:2692 +msgid "Expiry date cannot be more than 1 year in the future" +msgstr "Expiry date cannot be more than 1 year in the future" + +#: src/strings.ts:2690 +msgid "Expiry date must be in the future" +msgstr "Expiry date must be in the future" + +#: src/strings.ts:2693 +msgid "Expiry date set" +msgstr "Expiry date set" + #: src/strings.ts:2550 msgid "Explore all plans" msgstr "Explore all plans" diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po index 68a0acd5d..564938bd0 100644 --- a/packages/intl/locale/pseudo-LOCALE.po +++ b/packages/intl/locale/pseudo-LOCALE.po @@ -2756,6 +2756,18 @@ msgstr "" msgid "Expiry date" msgstr "" +#: src/strings.ts:2692 +msgid "Expiry date cannot be more than 1 year in the future" +msgstr "" + +#: src/strings.ts:2690 +msgid "Expiry date must be in the future" +msgstr "" + +#: src/strings.ts:2693 +msgid "Expiry date set" +msgstr "" + #: src/strings.ts:2550 msgid "Explore all plans" msgstr "" diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts index 9f5ebcd60..7b52d74a2 100644 --- a/packages/intl/src/strings.ts +++ b/packages/intl/src/strings.ts @@ -2686,5 +2686,9 @@ Continue without attachments?`, openingLocalFileDesc: (filePath: string) => t`Are you sure you want to open this file: ${filePath}?`, cantOpenFileLinksInBrowsers: () => - t`File links cannot be opened in browsers. Please use the Notesnook desktop app.` + t`File links cannot be opened in browsers. Please use the Notesnook desktop app.`, + 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` };