luowuyin's picture
25:05:05 10:41:39 v0.3.7
a572854
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
dayjs.extend(utc);
dayjs.extend(timezone);
const localTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
dayjs.tz.setDefault(localTimezone);
const originalFormat = dayjs.prototype.format;
dayjs.prototype.format = function (template: string) {
if (template === "YYYY-MM-DDTHH:mm:ssZ") {
return this.toISOString();
}
return originalFormat.call(this, template);
};
export default dayjs;