UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

18 lines (17 loc) 748 B
"use client"; import { getDefaultOptions as k } from "./_lib/defaultOptions.js"; import { constructFrom as f } from "./constructFrom.js"; import { startOfWeek as l } from "./startOfWeek.js"; import { toDate as m } from "./toDate.js"; function C(r, e) { const s = m(r, e?.in), t = s.getFullYear(), o = k(), i = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? o.firstWeekContainsDate ?? o.locale?.options?.firstWeekContainsDate ?? 1, a = f(e?.in || r, 0); a.setFullYear(t + 1, 0, i), a.setHours(0, 0, 0, 0); const c = l(a, e), n = f(e?.in || r, 0); n.setFullYear(t, 0, i), n.setHours(0, 0, 0, 0); const u = l(n, e); return +s >= +c ? t + 1 : +s >= +u ? t : t - 1; } export { C as default, C as getWeekYear };