diff --git a/packages/core/collections/reminders.js b/packages/core/collections/reminders.js index 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 License along with this program. If not, see . */ -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.js index 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}`);