mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
core: fix incorrect snooze time format
This commit is contained in:
@@ -17,14 +17,14 @@ You should have received a copy of the GNU General Public License
|
||||
along 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") {
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user