mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
core: format time correctly
This commit is contained in:
committed by
Abdullah Atta
parent
58f7a206d9
commit
c85242a610
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user