@aplus-frontend/ui
Version:
21 lines (20 loc) • 739 B
JavaScript
import { getUtcTimestamp as f } from "@aplus-frontend/utils";
import m from "dayjs";
const a = (e, o, r = !0) => {
if (!e)
return null;
let t = e.clone();
return t = t.millisecond(r ? 0 : 999), o.indexOf("ss") === -1 && (t = t.second(r ? 0 : 59)), o.indexOf("mm") === -1 && (t = t.minute(r ? 0 : 59)), o.indexOf("HH") === -1 && (t = t.hour(r ? 0 : 23)), o.indexOf("DD") === -1 && (t = t.date(r ? 1 : t.daysInMonth())), o.indexOf("MM") === -1 && (t = t.month(r ? 0 : 12)), t.valueOf();
};
function d(e) {
return (o, r, t = !0) => {
const n = r ? a(o, r, t) : o.valueOf();
return e ? f(m(n), e) : n;
};
}
const l = (e) => e && e.valueOf();
export {
a as formatDay,
d as formatDayWithTimezone,
l as formatValue
};