A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
core: fix incorrect snooze time format
ammarahm-ed09cd19d3b702
diff --git a/packages/core/collections/reminders.js b/packages/core/collections/reminders.jsindex b96e7acdc..49f84bdfd 100644--- a/packages/core/collections/reminders.js+++ b/packages/core/collections/reminders.js@@ -17,14 +17,14 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { getId } from "../utils/id";-import Collection from "./collection";import dayjs from "dayjs";+import isSameOrBefore from "dayjs/plugin/isSameOrBefore";import isToday from "dayjs/plugin/isToday";import isTomorrow from "dayjs/plugin/isTomorrow";import isYesterday from "dayjs/plugin/isYesterday";-import isSameOrBefore from "dayjs/plugin/isSameOrBefore";import { formatDate } from "../utils/date";+import { getId } from "../utils/id";+import Collection from "./collection";dayjs.extend(isTomorrow);dayjs.extend(isSameOrBefore);@@ -141,9 +141,10 @@ export function formatReminderTime(if (reminder.mode === "permanent") return `Ongoing`;if (reminder.snoozeUntil && reminder.snoozeUntil > Date.now()) {- return `Snoozed until ${dayjs(reminder.snoozeUntil).format(- options.timeFormat- )}`;+ return `Snoozed until ${formatDate(reminder.snoozeUntil, {+ timeFormat: options.timeFormat,+ type: "time"+ })}`;}if (reminder.mode === "repeat") {diff --git a/packages/core/utils/date.js b/packages/core/utils/date.jsindex 9a2256346..3d52642fc 100644--- a/packages/core/utils/date.js+++ b/packages/core/utils/date.js@@ -63,6 +63,10 @@ function getWeek(date) {return { start, end };}+export function getTimeFormat(format) {+ return format === "12-hour" ? "hh:mm A" : "HH:mm";+}+/**** @param {string | number | Date | null | undefined} date@@ -77,7 +81,7 @@ export function formatDate(type: "date-time"}) {- const timeFormat = options.timeFormat === "12-hour" ? "hh:mm A" : "HH:mm";+ const timeFormat = getTimeFormat(options.timeFormat);switch (options.type) {case "date-time":return dayjs(date).format(`${options.dateFormat} ${timeFormat}`);