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: format time correctly
ammarahm-edc85242a61014
diff --git a/packages/core/collections/reminders.js b/packages/core/collections/reminders.jsindex 2ad19c7fc..15ed9b1ee 100644--- a/packages/core/collections/reminders.js+++ b/packages/core/collections/reminders.js@@ -148,20 +148,21 @@ export function formatReminderTime(if (reminder.mode === "repeat") {time = getUpcomingReminderTime(reminder);}+ const timeFormat = options.timeFormat === "12-hour" ? "h:mm A" : "HH:mm";if (dayjs(time).isTomorrow()) {tag = "Upcoming";- text = `Tomorrow, ${dayjs(time).format(options.timeFormat)}`;+ text = `Tomorrow, ${dayjs(time).format(timeFormat)}`;} else if (dayjs(time).isYesterday()) {tag = "Last";- text = `Yesterday, ${dayjs(time).format(options.timeFormat)}`;+ text = `Yesterday, ${dayjs(time).format(timeFormat)}`;} else {const isPast = dayjs(time).isSameOrBefore(dayjs());tag = isPast ? "Last" : "Upcoming";if (dayjs(time).isToday()) {- text = `Today, ${dayjs(time).format(options.timeFormat)}`;+ text = `Today, ${dayjs(time).format(timeFormat)}`;} else {- text = dayjs(time).format(options.dateFormat);+ text = dayjs(time).format(`${options.dateFormat} ${timeFormat}`);}}diff --git a/packages/core/utils/date.js b/packages/core/utils/date.jsindex a8619ec7b..4fa0fc14c 100644--- a/packages/core/utils/date.js+++ b/packages/core/utils/date.js@@ -77,17 +77,12 @@ export function formatDate(type: "date-time"}) {+ const timeFormat = options.timeFormat === "12-hour" ? "h:mm A" : "HH:mm";switch (options.type) {case "date-time":- return dayjs(date).format(- `${options.dateFormat} ${- options.timeFormat === "12-hour" ? "h:mm A" : "HH:mm"- }`- );+ return dayjs(date).format(`${options.dateFormat} ${timeFormat}`);case "time":- return dayjs(date).format(- `${options.timeFormat === "12-hour" ? "h:mm A" : "HH:mm"}`- );+ return dayjs(date).format(timeFormat);case "date":return dayjs(date).format(`${options.dateFormat}`);}