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)

31 lines (30 loc) 1.33 kB
import { SYSTEM_TIMEZONE_FORMATTER as n, REGEX_TZ_OFFSET as m } from "./constants.js"; import { EMPTY_ARRAY as r } from "../../../../utils/value/constants.js"; import { mod as i } from "../../../../utils/value/number.js"; const p = /\+(?=-)|([+-]00:00)/g, E = /(^\D?)(\d)$/, O = ([t, e]) => (Math.abs(t * 60) + e) * (t < 0 ? -1 : 1), S = (t) => Object.freeze([ Math.floor(t / 60), // offset hours i(t, 60) // offset minutes ]), _ = (t) => parseInt(t, 10) || 0, F = (t) => `GMT+${S(t).map((o) => `${o}`.replace(E, "$10$2")).join(":")}`.replace(p, ""), c = (t) => { var s; const e = ((s = t == null ? void 0 : t.match(m)) == null ? void 0 : s[0].replace("GMT", "").split(":", 2).map(_)) ?? r; return O(e.concat(0, 0).slice(0, 2)); }, R = (t, e = n) => { var f; const s = c((f = n) == null ? void 0 : f.format(t)); return c(e == null ? void 0 : e.format(t)) - s; }, T = (t, e, s = 1) => { const { offset: o, timestamp: f } = t(e); return f - o * s * 6e4; }, g = (t, e) => T(t, e, 1), u = (t, e) => T(t, e, -1); export { O as computeTimezoneOffsetInMinutes, S as computeTimezoneOffsetsFromMinutes, F as getGMTSuffixForTimezoneOffset, R as getTimezoneOffsetForTimestamp, c as getTimezoneOffsetFromFormattedDateString, _ as parseTimezoneOffset, g as systemToTimezone, u as timezoneToSystem };