@adyen/adyen-platform-experience-web
Version:

33 lines (32 loc) • 1 kB
JavaScript
import m from "./TimeSlice.js";
import { RANGE_FROM as c, RANGE_TO as l } from "../constants.js";
import { withTimezone as r } from "../utils.js";
import { struct as f } from "../../../../../utils/struct/main.js";
import { getter as o } from "../../../../../utils/struct/property.js";
const n = (...s) => {
let t = r().tz.current, e = new m(t, ...s);
return f({
from: o(() => e.startTimestamp, !1),
to: o(() => e.endTimestamp, !1),
offsets: {
value: f({
from: o(() => e.startTimestampOffset, !1),
to: o(() => e.endTimestampOffset, !1)
})
},
span: o(() => e.numberOfMonths, !1),
timezone: {
...o(() => t, !1),
set: (i) => {
const a = t;
t = r(i ?? void 0).tz.current, t !== a && (e = new m(t, ...s));
}
}
});
}, p = n(), N = () => n(Date.now(), c), O = () => n(Date.now(), l), d = (...s) => s.length === 0 ? p : n(...s);
export {
p as UNBOUNDED_SLICE,
d as default,
N as sinceNow,
O as untilNow
};