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>
This commit is contained in:
01zulfi
2026-06-02 13:02:06 +05:00
committed by GitHub
parent cf5565d09d
commit 2aa5162fc9
4 changed files with 15 additions and 8 deletions

View File

@@ -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");

View File

@@ -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"

View File

@@ -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 ""

View File

@@ -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`
};