mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-07-10 04:21:21 +02:00
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:
@@ -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");
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 ""
|
||||
|
||||
@@ -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`
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user