UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

26 lines (25 loc) 843 B
import p from "../../factory.js"; import { offsetsForNDays as D, getRangeTimestampsContextIntegerPropertyFactory as y, nowTimestamp as F } from "../../utils.js"; import { startOfWeek as g } from "../../../utils.js"; import { clamp as E } from "../../../../../../../utils/value/number.js"; const r = 1, W = D(7), k = y(0, 6, r), C = (s = 0) => { const e = ~~E(0, s, 1 / 0) || 0; return (n = r) => { const a = e ? { offsets: W } : { to: F }, o = k(n); return p( { from: ({ now: f, timezone: m, systemToTimezone: i, timezoneToSystem: c }) => { const t = new Date(c(g(f, m, o.value))); return t.setDate(t.getDate() - e * 7), i(t); }, ...a }, { firstWeekDay: o.descriptor } )(); }; }; export { r as DEFAULT_FIRST_WEEK_DAY, W as ONE_WEEK_OFFSETS, C as default };