From 6ddd5078ac6012cd84fc38bb9163ffc0e3ebcda7 Mon Sep 17 00:00:00 2001 From: kashaf-ansari-dev Date: Fri, 22 May 2026 14:07:17 +0500 Subject: [PATCH 1/6] mobile: fix unset note expiry date Signed-off-by: kashaf-ansari-dev --- apps/mobile/app/hooks/use-actions.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx index e0516ce57..e0fb8b95e 100644 --- a/apps/mobile/app/hooks/use-actions.tsx +++ b/apps/mobile/app/hooks/use-actions.tsx @@ -1180,11 +1180,13 @@ export const useActions = ({ }, { id: "expiry-date", - title: item.expiryDate ? strings.unsetExpiry() : strings.setExpiry(), - icon: item.expiryDate ? "bomb-off" : "bomb", + title: item.expiryDate?.value + ? strings.unsetExpiry() + : strings.setExpiry(), + icon: item.expiryDate.value ? "bomb-off" : "bomb", locked: !features?.expiringNotes?.isAllowed, onPress: async () => { - if (item.expiryDate) { + if (item.expiryDate?.value) { await db.notes.setExpiryDate(null, item.id); setItem((await db.notes.note(item.id)) as Item); } else { From 9e5ed67eb31bbb304b671c7a82ff6574a5e389d0 Mon Sep 17 00:00:00 2001 From: kashaf-ansari-dev Date: Mon, 1 Jun 2026 23:49:44 +0500 Subject: [PATCH 2/6] mobile: prevent crash in note properties when expiryDate is undefined Signed-off-by: kashaf-ansari-dev --- apps/mobile/app/hooks/use-actions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx index e0fb8b95e..a23dd9c23 100644 --- a/apps/mobile/app/hooks/use-actions.tsx +++ b/apps/mobile/app/hooks/use-actions.tsx @@ -1183,7 +1183,7 @@ export const useActions = ({ title: item.expiryDate?.value ? strings.unsetExpiry() : strings.setExpiry(), - icon: item.expiryDate.value ? "bomb-off" : "bomb", + icon: item.expiryDate?.value ? "bomb-off" : "bomb", locked: !features?.expiringNotes?.isAllowed, onPress: async () => { if (item.expiryDate?.value) { From 20f39b82c6d82bd124e950bdf347df0f1b6d8246 Mon Sep 17 00:00:00 2001 From: kashaf-ansari-dev Date: Fri, 5 Jun 2026 14:22:27 +0500 Subject: [PATCH 3/6] mobile: add success messages on setting or removing expiry date Signed-off-by: kashaf-ansari-dev --- apps/mobile/app/hooks/use-actions.tsx | 14 ++++++++++++++ packages/intl/locale/en.po | 4 ++++ packages/intl/locale/pseudo-LOCALE.po | 4 ++++ packages/intl/src/strings.ts | 3 ++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx index a23dd9c23..8b4bcd9c9 100644 --- a/apps/mobile/app/hooks/use-actions.tsx +++ b/apps/mobile/app/hooks/use-actions.tsx @@ -1188,6 +1188,13 @@ export const useActions = ({ onPress: async () => { if (item.expiryDate?.value) { await db.notes.setExpiryDate(null, item.id); + + ToastManager.show({ + message: strings.expiryDateRemoved(), + type: "success", + context: "local" + }); + setItem((await db.notes.note(item.id)) as Item); } else { if (features && !features?.expiringNotes.isAllowed) { @@ -1211,6 +1218,13 @@ export const useActions = ({ onConfirm={async (date) => { close?.(); await db.notes.setExpiryDate(date.getTime(), item.id); + + ToastManager.show({ + message: strings.expiryDateSet(), + type: "success", + context: "local" + }); + setItem((await db.notes.note(item.id)) as Item); }} /> diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po index 752dbf124..8abcecd03 100644 --- a/packages/intl/locale/en.po +++ b/packages/intl/locale/en.po @@ -2783,6 +2783,10 @@ msgstr "Expiry date cannot be more than 1 year in the future" msgid "Expiry date must be in the future" msgstr "Expiry date must be in the future" +#: src/strings.ts:2706 +msgid "Expiry date removed" +msgstr "Expiry date removed" + #: src/strings.ts:2693 msgid "Expiry date set" msgstr "Expiry date set" diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po index becdf37c1..1c6b1e689 100644 --- a/packages/intl/locale/pseudo-LOCALE.po +++ b/packages/intl/locale/pseudo-LOCALE.po @@ -2772,6 +2772,10 @@ msgstr "" msgid "Expiry date must be in the future" msgstr "" +#: src/strings.ts:2706 +msgid "Expiry date removed" +msgstr "" + #: src/strings.ts:2693 msgid "Expiry date set" msgstr "" diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts index d5daa0159..9e6a052e6 100644 --- a/packages/intl/src/strings.ts +++ b/packages/intl/src/strings.ts @@ -2702,5 +2702,6 @@ Continue without attachments?`, t`We couldn't load this theme. The file appears to be incomplete or missing required theme properties.`, copyLogs: () => t`Copy logs`, permissionRequiredToSaveQRCode: () => - t`Permission required to save QR-Code to Gallery` + t`Permission required to save QR-Code to Gallery`, + expiryDateRemoved: () => t`Expiry date removed` }; From 07d7a537e42ee2294d24fc0d2ac9de7bcb63fe39 Mon Sep 17 00:00:00 2001 From: kashaf-ansari-dev Date: Fri, 5 Jun 2026 16:00:45 +0500 Subject: [PATCH 4/6] mobile: display expiry date on notes item Signed-off-by: kashaf-ansari-dev --- .../app/components/list-items/note/index.tsx | 16 ++++ .../app/components/ui/expiry-date/index.tsx | 86 +++++++++++++++++++ apps/mobile/app/hooks/use-actions.tsx | 12 ++- 3 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 apps/mobile/app/components/ui/expiry-date/index.tsx diff --git a/apps/mobile/app/components/list-items/note/index.tsx b/apps/mobile/app/components/list-items/note/index.tsx index afbaae87e..75814a332 100644 --- a/apps/mobile/app/components/list-items/note/index.tsx +++ b/apps/mobile/app/components/list-items/note/index.tsx @@ -55,6 +55,7 @@ import { TimeSince } from "../../ui/time-since"; import Heading from "../../ui/typography/heading"; import Paragraph from "../../ui/typography/paragraph"; import dayjs from "dayjs"; +import { ExpiryDate } from "../../ui/expiry-date"; type NoteItemProps = { item: Note | BaseTrashItem; @@ -266,6 +267,21 @@ const NoteItem = ({ /> ) : null} + {item.expiryDate?.value ? ( + + ) : null} + {notebooks?.items ?.filter( (item) => diff --git a/apps/mobile/app/components/ui/expiry-date/index.tsx b/apps/mobile/app/components/ui/expiry-date/index.tsx new file mode 100644 index 000000000..e5eba35fd --- /dev/null +++ b/apps/mobile/app/components/ui/expiry-date/index.tsx @@ -0,0 +1,86 @@ +/* +This file is part of the Notesnook project (https://notesnook.com/) + +Copyright (C) 2023 Streetwriters (Private) Limited + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +import { Note } from "@notesnook/core"; +import { useThemeColors } from "@notesnook/theme"; +import React from "react"; +import { TextStyle, ViewStyle } from "react-native"; +import { AppFontSize, defaultBorderRadius } from "../../../utils/size"; +import { DefaultAppStyles } from "../../../utils/styles"; +import { Button, ButtonProps } from "../button"; +import dayjs from "dayjs"; + +export const ExpiryDate = ({ + note, + color, + style, + textStyle, + iconSize, + short, + ...props +}: { + note: Note; + color?: string; + style?: ViewStyle; + textStyle?: TextStyle; + iconSize?: number; + short?: boolean; +} & ButtonProps) => { + const { colors } = useThemeColors(); + + const expiryValue = note?.expiryDate?.value; + if (!expiryValue) return null; + + const expiryDate = dayjs(expiryValue); + const now = dayjs(); + const isToday = expiryDate.isSame(now, "day"); + const isTomorrow = expiryDate.isSame(now.add(1, "day"), "day"); + + const formattedDate = isToday + ? "Today" + : isTomorrow + ? "Tomorrow" + : expiryDate.format("DD MMM YYYY"); + + const isUrgent = isToday || isTomorrow; + + return ( +