This commit is contained in:
Alex Holliday
2024-09-14 10:48:03 +08:00
11 changed files with 1825 additions and 78 deletions
+11
View File
@@ -1,3 +1,9 @@
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
dayjs.extend(utc);
dayjs.extend(timezone);
export const formatDuration = (ms) => {
const seconds = Math.floor(ms / 1000);
const minutes = Math.floor(seconds / 60);
@@ -76,3 +82,8 @@ export const formatDate = (date, customOptions) => {
.toLocaleString("en-US", options)
.replace(/\b(AM|PM)\b/g, (match) => match.toLowerCase());
};
export const formatDateWithTz = (timestamp, format, timezone) => {
const formattedDate = dayjs(timestamp, timezone).tz(timezone).format(format);
return formattedDate;
};
File diff suppressed because it is too large Load Diff