@blakesteve/roster 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/dist/hooks/useCountdown.cjs +1 -1
  3. package/dist/hooks/useCountdown.d.ts +9 -0
  4. package/dist/hooks/useCountdown.js +20 -23
  5. package/dist/meta.json +2 -2
  6. package/package.json +3 -4
  7. package/dist/node_modules/date-fns/_lib/getRoundingMethod.cjs +0 -1
  8. package/dist/node_modules/date-fns/_lib/getRoundingMethod.js +0 -9
  9. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.cjs +0 -1
  10. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -18
  11. package/dist/node_modules/date-fns/_lib/normalizeDates.cjs +0 -1
  12. package/dist/node_modules/date-fns/_lib/normalizeDates.js +0 -11
  13. package/dist/node_modules/date-fns/_lib/normalizeInterval.cjs +0 -1
  14. package/dist/node_modules/date-fns/_lib/normalizeInterval.js +0 -8
  15. package/dist/node_modules/date-fns/add.cjs +0 -1
  16. package/dist/node_modules/date-fns/add.js +0 -19
  17. package/dist/node_modules/date-fns/addDays.cjs +0 -1
  18. package/dist/node_modules/date-fns/addDays.js +0 -9
  19. package/dist/node_modules/date-fns/addMonths.cjs +0 -1
  20. package/dist/node_modules/date-fns/addMonths.js +0 -19
  21. package/dist/node_modules/date-fns/compareAsc.cjs +0 -1
  22. package/dist/node_modules/date-fns/compareAsc.js +0 -8
  23. package/dist/node_modules/date-fns/constants.cjs +0 -1
  24. package/dist/node_modules/date-fns/constants.js +0 -7
  25. package/dist/node_modules/date-fns/constructFrom.cjs +0 -1
  26. package/dist/node_modules/date-fns/constructFrom.js +0 -7
  27. package/dist/node_modules/date-fns/differenceInCalendarDays.cjs +0 -1
  28. package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -15
  29. package/dist/node_modules/date-fns/differenceInCalendarMonths.cjs +0 -1
  30. package/dist/node_modules/date-fns/differenceInCalendarMonths.js +0 -12
  31. package/dist/node_modules/date-fns/differenceInCalendarYears.cjs +0 -1
  32. package/dist/node_modules/date-fns/differenceInCalendarYears.js +0 -12
  33. package/dist/node_modules/date-fns/differenceInDays.cjs +0 -1
  34. package/dist/node_modules/date-fns/differenceInDays.js +0 -21
  35. package/dist/node_modules/date-fns/differenceInHours.cjs +0 -1
  36. package/dist/node_modules/date-fns/differenceInHours.js +0 -14
  37. package/dist/node_modules/date-fns/differenceInMilliseconds.cjs +0 -1
  38. package/dist/node_modules/date-fns/differenceInMilliseconds.js +0 -7
  39. package/dist/node_modules/date-fns/differenceInMinutes.cjs +0 -1
  40. package/dist/node_modules/date-fns/differenceInMinutes.js +0 -10
  41. package/dist/node_modules/date-fns/differenceInMonths.cjs +0 -1
  42. package/dist/node_modules/date-fns/differenceInMonths.js +0 -23
  43. package/dist/node_modules/date-fns/differenceInSeconds.cjs +0 -1
  44. package/dist/node_modules/date-fns/differenceInSeconds.js +0 -9
  45. package/dist/node_modules/date-fns/differenceInYears.cjs +0 -1
  46. package/dist/node_modules/date-fns/differenceInYears.js +0 -16
  47. package/dist/node_modules/date-fns/endOfDay.cjs +0 -1
  48. package/dist/node_modules/date-fns/endOfDay.js +0 -8
  49. package/dist/node_modules/date-fns/endOfMonth.cjs +0 -1
  50. package/dist/node_modules/date-fns/endOfMonth.js +0 -8
  51. package/dist/node_modules/date-fns/intervalToDuration.cjs +0 -1
  52. package/dist/node_modules/date-fns/intervalToDuration.js +0 -25
  53. package/dist/node_modules/date-fns/isAfter.cjs +0 -1
  54. package/dist/node_modules/date-fns/isAfter.js +0 -7
  55. package/dist/node_modules/date-fns/isLastDayOfMonth.cjs +0 -1
  56. package/dist/node_modules/date-fns/isLastDayOfMonth.js +0 -10
  57. package/dist/node_modules/date-fns/startOfDay.cjs +0 -1
  58. package/dist/node_modules/date-fns/startOfDay.js +0 -8
  59. package/dist/node_modules/date-fns/toDate.cjs +0 -1
  60. package/dist/node_modules/date-fns/toDate.js +0 -7
package/README.md CHANGED
@@ -1228,7 +1228,7 @@ the one that can not be affected by a future change to the barrel.
1228
1228
 
1229
1229
  | Hook | Description |
1230
1230
  | ---------------- | ------------------------------------------------------------------------------- |
1231
- | `useCountdown` | Countdown timer logic without the UI |
1231
+ | `useCountdown` | Countdown timer logic without the UI; `days` counts the whole remaining total |
1232
1232
  | `useKeySequence` | Fires a callback when a sequence of keys is typed in order. Ships `KONAMI_CODE` |
1233
1233
 
1234
1234
  ## Authoring components: the `rst:` prefix
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),l=require("../node_modules/date-fns/isAfter.cjs"),f=require("../node_modules/date-fns/intervalToDuration.cjs"),m=u=>{const e=u.getTime(),n=i.useCallback(()=>{const t=new Date,s=new Date(e);if(l.isAfter(t,s))return{days:0,hours:0,minutes:0,seconds:0,isFinished:!0};const r=f.intervalToDuration({start:t,end:s});return{days:r.days??0,hours:r.hours??0,minutes:r.minutes??0,seconds:r.seconds??0,isFinished:!1}},[e]),[a,o]=i.useState(n),[c,d]=i.useState(e);return Object.is(c,e)||(d(e),o(n())),i.useEffect(()=>{if(Number.isNaN(e))return;const t=setInterval(()=>{const s=n();o(s),s.isFinished&&clearInterval(t)},1e3);return()=>clearInterval(t)},[e,n]),a};exports.useCountdown=m;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),l=o=>{const e=o.getTime(),n=r.useCallback(()=>{if(Number.isNaN(e))return{days:0,hours:0,minutes:0,seconds:0,isFinished:!1};const s=e-Date.now();if(s<0)return{days:0,hours:0,minutes:0,seconds:0,isFinished:!0};const t=Math.floor(s/1e3);return{days:Math.floor(t/86400),hours:Math.floor(t%86400/3600),minutes:Math.floor(t%3600/60),seconds:t%60,isFinished:!1}},[e]),[a,i]=r.useState(n),[u,c]=r.useState(e);return Object.is(u,e)||(c(e),i(n())),r.useEffect(()=>{if(Number.isNaN(e))return;const s=setInterval(()=>{const t=n();i(t),t.isFinished&&clearInterval(s)},1e3);return()=>clearInterval(s)},[e,n]),a};exports.useCountdown=l;
@@ -1,8 +1,17 @@
1
1
  interface CountdownResult {
2
+ /**
3
+ * Whole days remaining, as the full total rather than a remainder within a
4
+ * month. A target a year out reads 365, so a display that assumes two digits
5
+ * needs room for three.
6
+ */
2
7
  days: number;
8
+ /** Hours past the whole days, 0 to 23. */
3
9
  hours: number;
10
+ /** Minutes past the whole hours, 0 to 59. */
4
11
  minutes: number;
12
+ /** Seconds past the whole minutes, 0 to 59. */
5
13
  seconds: number;
14
+ /** True once the target has passed. Stays false for an invalid target. */
6
15
  isFinished: boolean;
7
16
  }
8
17
  export declare const useCountdown: (targetDate: Date) => CountdownResult;
@@ -1,33 +1,30 @@
1
1
  "use client";
2
- import { useCallback as m, useState as o, useEffect as f } from "react";
3
- import { isAfter as l } from "../node_modules/date-fns/isAfter.js";
4
- import { intervalToDuration as h } from "../node_modules/date-fns/intervalToDuration.js";
5
- const F = (a) => {
6
- const e = a.getTime(), n = m(() => {
7
- const t = /* @__PURE__ */ new Date(), s = new Date(e);
8
- if (l(t, s))
2
+ import { useCallback as l, useState as i, useEffect as f } from "react";
3
+ const m = (o) => {
4
+ const e = o.getTime(), n = l(() => {
5
+ if (Number.isNaN(e))
6
+ return { days: 0, hours: 0, minutes: 0, seconds: 0, isFinished: !1 };
7
+ const s = e - Date.now();
8
+ if (s < 0)
9
9
  return { days: 0, hours: 0, minutes: 0, seconds: 0, isFinished: !0 };
10
- const r = h({
11
- start: t,
12
- end: s
13
- });
10
+ const t = Math.floor(s / 1e3);
14
11
  return {
15
- days: r.days ?? 0,
16
- hours: r.hours ?? 0,
17
- minutes: r.minutes ?? 0,
18
- seconds: r.seconds ?? 0,
12
+ days: Math.floor(t / 86400),
13
+ hours: Math.floor(t % 86400 / 3600),
14
+ minutes: Math.floor(t % 3600 / 60),
15
+ seconds: t % 60,
19
16
  isFinished: !1
20
17
  };
21
- }, [e]), [u, i] = o(n), [c, d] = o(e);
22
- return Object.is(c, e) || (d(e), i(n())), f(() => {
18
+ }, [e]), [a, r] = i(n), [u, c] = i(e);
19
+ return Object.is(u, e) || (c(e), r(n())), f(() => {
23
20
  if (Number.isNaN(e)) return;
24
- const t = setInterval(() => {
25
- const s = n();
26
- i(s), s.isFinished && clearInterval(t);
21
+ const s = setInterval(() => {
22
+ const t = n();
23
+ r(t), t.isFinished && clearInterval(s);
27
24
  }, 1e3);
28
- return () => clearInterval(t);
29
- }, [e, n]), u;
25
+ return () => clearInterval(s);
26
+ }, [e, n]), a;
30
27
  };
31
28
  export {
32
- F as useCountdown
29
+ m as useCountdown
33
30
  };
package/dist/meta.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.0.0",
3
- "tests": 1420,
2
+ "version": "5.0.1",
3
+ "tests": 1432,
4
4
  "testFiles": 111
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blakesteve/roster",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "A production-grade atomic component library: accessible, theme-aware, and documented in Storybook. React 19, TypeScript, Tailwind CSS v4.",
5
5
  "keywords": [
6
6
  "react",
@@ -116,14 +116,14 @@
116
116
  "postcss": "^8.5.6",
117
117
  "react": "^19.2.4",
118
118
  "react-dom": "^19.2.4",
119
+ "react-hot-toast": "^2.6.0",
119
120
  "storybook": "^10.2.8",
120
121
  "tailwindcss": "^4.1.18",
121
122
  "typescript": "~5.9.3",
122
123
  "typescript-eslint": "^8.46.4",
123
124
  "vite": "^7.2.4",
124
125
  "vite-plugin-dts": "^4.5.4",
125
- "vitest": "^4.0.18",
126
- "react-hot-toast": "^2.6.0"
126
+ "vitest": "^4.0.18"
127
127
  },
128
128
  "dependencies": {
129
129
  "@fortawesome/fontawesome-svg-core": "^7.2.0",
@@ -133,7 +133,6 @@
133
133
  "@radix-ui/react-tooltip": "^1.2.8",
134
134
  "class-variance-authority": "^0.7.1",
135
135
  "clsx": "^2.1.1",
136
- "date-fns": "^4.1.0",
137
136
  "tailwind-merge": "^3.4.0"
138
137
  }
139
138
  }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}exports.getRoundingMethod=o;
@@ -1,9 +0,0 @@
1
- function o(n) {
2
- return (r) => {
3
- const t = (n ? Math[n] : Math.trunc)(r);
4
- return t === 0 ? 0 : t;
5
- };
6
- }
7
- export {
8
- o as getRoundingMethod
9
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../toDate.cjs");function s(t){const e=o.toDate(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}exports.getTimezoneOffsetInMilliseconds=s;
@@ -1,18 +0,0 @@
1
- import { toDate as o } from "../toDate.js";
2
- function l(t) {
3
- const e = o(t), n = new Date(
4
- Date.UTC(
5
- e.getFullYear(),
6
- e.getMonth(),
7
- e.getDate(),
8
- e.getHours(),
9
- e.getMinutes(),
10
- e.getSeconds(),
11
- e.getMilliseconds()
12
- )
13
- );
14
- return n.setUTCFullYear(e.getFullYear()), +t - +n;
15
- }
16
- export {
17
- l as getTimezoneOffsetInMilliseconds
18
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../constructFrom.cjs");function r(c,...t){const e=n.constructFrom.bind(null,t.find(o=>typeof o=="object"));return t.map(e)}exports.normalizeDates=r;
@@ -1,11 +0,0 @@
1
- import { constructFrom as r } from "../constructFrom.js";
2
- function i(e, ...o) {
3
- const n = r.bind(
4
- null,
5
- o.find((t) => typeof t == "object")
6
- );
7
- return o.map(n);
8
- }
9
- export {
10
- i as normalizeDates
11
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./normalizeDates.cjs");function o(t,e){const[r,n]=a.normalizeDates(t,e.start,e.end);return{start:r,end:n}}exports.normalizeInterval=o;
@@ -1,8 +0,0 @@
1
- import { normalizeDates as o } from "./normalizeDates.js";
2
- function m(r, t) {
3
- const [n, e] = o(r, t.start, t.end);
4
- return { start: n, end: e };
5
- }
6
- export {
7
- m as normalizeInterval
8
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("./addDays.cjs"),T=require("./addMonths.cjs"),q=require("./constructFrom.cjs"),A=require("./toDate.cjs");function M(t,r,l){const{years:o=0,months:s=0,weeks:d=0,days:e=0,hours:a=0,minutes:u=0,seconds:i=0}=r,n=A.toDate(t),c=s||o?T.addMonths(n,s+o*12):n,h=e||d?D.addDays(c,e+d*7):c,m=u+a*60,y=(i+m*60)*1e3;return q.constructFrom(t,+h+y)}exports.add=M;
@@ -1,19 +0,0 @@
1
- import { addDays as f } from "./addDays.js";
2
- import { addMonths as y } from "./addMonths.js";
3
- import { constructFrom as A } from "./constructFrom.js";
4
- import { toDate as T } from "./toDate.js";
5
- function F(o, e, D) {
6
- const {
7
- years: t = 0,
8
- months: s = 0,
9
- weeks: d = 0,
10
- days: n = 0,
11
- hours: m = 0,
12
- minutes: a = 0,
13
- seconds: i = 0
14
- } = e, r = T(o), c = s || t ? y(r, s + t * 12) : r, h = n || d ? f(c, n + d * 7) : c, p = a + m * 60, u = (i + p * 60) * 1e3;
15
- return A(o, +h + u);
16
- }
17
- export {
18
- F as add
19
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./constructFrom.cjs"),s=require("./toDate.cjs");function n(r,e,a){const t=s.toDate(r);return isNaN(e)?o.constructFrom(r,NaN):(e&&t.setDate(t.getDate()+e),t)}exports.addDays=n;
@@ -1,9 +0,0 @@
1
- import { constructFrom as e } from "./constructFrom.js";
2
- import { toDate as i } from "./toDate.js";
3
- function f(o, r, n) {
4
- const t = i(o);
5
- return isNaN(r) ? e(o, NaN) : (r && t.setDate(t.getDate() + r), t);
6
- }
7
- export {
8
- f as addDays
9
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./constructFrom.cjs"),i=require("./toDate.cjs");function u(o,n,a){const t=i.toDate(o);if(isNaN(n))return s.constructFrom(o,NaN);if(!n)return t;const r=t.getDate(),e=s.constructFrom(o,t.getTime());e.setMonth(t.getMonth()+n+1,0);const c=e.getDate();return r>=c?e:(t.setFullYear(e.getFullYear(),e.getMonth(),r),t)}exports.addMonths=u;
@@ -1,19 +0,0 @@
1
- import { constructFrom as s } from "./constructFrom.js";
2
- import { toDate as f } from "./toDate.js";
3
- function M(o, n, a) {
4
- const t = f(o);
5
- if (isNaN(n)) return s(o, NaN);
6
- if (!n)
7
- return t;
8
- const r = t.getDate(), e = s(o, t.getTime());
9
- e.setMonth(t.getMonth() + n + 1, 0);
10
- const i = e.getDate();
11
- return r >= i ? e : (t.setFullYear(
12
- e.getFullYear(),
13
- e.getMonth(),
14
- r
15
- ), t);
16
- }
17
- export {
18
- M as addMonths
19
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./toDate.cjs");function c(r,o){const e=+t.toDate(r)-+t.toDate(o);return e<0?-1:e>0?1:e}exports.compareAsc=c;
@@ -1,8 +0,0 @@
1
- import { toDate as t } from "./toDate.js";
2
- function n(e, o) {
3
- const r = +t(e) - +t(o);
4
- return r < 0 ? -1 : r > 0 ? 1 : r;
5
- }
6
- export {
7
- n as compareAsc
8
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=864e5,n=6e4,s=36e5,t=Symbol.for("constructDateFrom");exports.constructFromSymbol=t;exports.millisecondsInDay=o;exports.millisecondsInHour=s;exports.millisecondsInMinute=n;
@@ -1,7 +0,0 @@
1
- const o = 864e5, n = 6e4, s = 36e5, c = /* @__PURE__ */ Symbol.for("constructDateFrom");
2
- export {
3
- c as constructFromSymbol,
4
- o as millisecondsInDay,
5
- s as millisecondsInHour,
6
- n as millisecondsInMinute
7
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./constants.cjs");function n(o,r){return typeof o=="function"?o(r):o&&typeof o=="object"&&t.constructFromSymbol in o?o[t.constructFromSymbol](r):o instanceof Date?new o.constructor(r):new Date(r)}exports.constructFrom=n;
@@ -1,7 +0,0 @@
1
- import { constructFromSymbol as o } from "./constants.js";
2
- function c(r, n) {
3
- return typeof r == "function" ? r(n) : r && typeof r == "object" && o in r ? r[o](n) : r instanceof Date ? new r.constructor(n) : new Date(n);
4
- }
5
- export {
6
- c as constructFrom
7
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./_lib/getTimezoneOffsetInMilliseconds.cjs"),D=require("./_lib/normalizeDates.cjs"),d=require("./constants.cjs"),a=require("./startOfDay.cjs");function m(r,s,i){const[o,l]=D.normalizeDates(i?.in,r,s),e=a.startOfDay(o),t=a.startOfDay(l),c=+e-n.getTimezoneOffsetInMilliseconds(e),f=+t-n.getTimezoneOffsetInMilliseconds(t);return Math.round((c-f)/d.millisecondsInDay)}exports.differenceInCalendarDays=m;
@@ -1,15 +0,0 @@
1
- import { getTimezoneOffsetInMilliseconds as r } from "./_lib/getTimezoneOffsetInMilliseconds.js";
2
- import { normalizeDates as c } from "./_lib/normalizeDates.js";
3
- import { millisecondsInDay as D } from "./constants.js";
4
- import { startOfDay as a } from "./startOfDay.js";
5
- function u(o, n, i) {
6
- const [m, s] = c(
7
- i?.in,
8
- o,
9
- n
10
- ), t = a(m), e = a(s), f = +t - r(t), l = +e - r(e);
11
- return Math.round((f - l) / D);
12
- }
13
- export {
14
- u as differenceInCalendarDays
15
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./_lib/normalizeDates.cjs");function s(n,r,a){const[e,t]=l.normalizeDates(a?.in,n,r),o=e.getFullYear()-t.getFullYear(),i=e.getMonth()-t.getMonth();return o*12+i}exports.differenceInCalendarMonths=s;
@@ -1,12 +0,0 @@
1
- import { normalizeDates as i } from "./_lib/normalizeDates.js";
2
- function s(n, r, o) {
3
- const [e, t] = i(
4
- o?.in,
5
- n,
6
- r
7
- ), a = e.getFullYear() - t.getFullYear(), f = e.getMonth() - t.getMonth();
8
- return a * 12 + f;
9
- }
10
- export {
11
- s as differenceInCalendarMonths
12
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./_lib/normalizeDates.cjs");function i(e,r,a){const[t,n]=l.normalizeDates(a?.in,e,r);return t.getFullYear()-n.getFullYear()}exports.differenceInCalendarYears=i;
@@ -1,12 +0,0 @@
1
- import { normalizeDates as l } from "./_lib/normalizeDates.js";
2
- function o(e, r, a) {
3
- const [t, n] = l(
4
- a?.in,
5
- e,
6
- r
7
- );
8
- return t.getFullYear() - n.getFullYear();
9
- }
10
- export {
11
- o as differenceInCalendarYears
12
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./_lib/normalizeDates.cjs"),d=require("./differenceInCalendarDays.cjs");function l(e,n,t){const[s,o]=r.normalizeDates(t?.in,e,n),c=g(s,o),i=Math.abs(d.differenceInCalendarDays(s,o));s.setDate(s.getDate()-c*i);const f=+(g(s,o)===-c),u=c*(i-f);return u===0?0:u}function g(e,n){const t=e.getFullYear()-n.getFullYear()||e.getMonth()-n.getMonth()||e.getDate()-n.getDate()||e.getHours()-n.getHours()||e.getMinutes()-n.getMinutes()||e.getSeconds()-n.getSeconds()||e.getMilliseconds()-n.getMilliseconds();return t<0?-1:t>0?1:t}exports.differenceInDays=l;
@@ -1,21 +0,0 @@
1
- import { normalizeDates as r } from "./_lib/normalizeDates.js";
2
- import { differenceInCalendarDays as d } from "./differenceInCalendarDays.js";
3
- function l(n, t, s) {
4
- const [o, e] = r(
5
- s?.in,
6
- n,
7
- t
8
- ), c = u(o, e), g = Math.abs(
9
- d(o, e)
10
- );
11
- o.setDate(o.getDate() - c * g);
12
- const f = +(u(o, e) === -c), i = c * (g - f);
13
- return i === 0 ? 0 : i;
14
- }
15
- function u(n, t) {
16
- const s = n.getFullYear() - t.getFullYear() || n.getMonth() - t.getMonth() || n.getDate() - t.getDate() || n.getHours() - t.getHours() || n.getMinutes() - t.getMinutes() || n.getSeconds() - t.getSeconds() || n.getMilliseconds() - t.getMilliseconds();
17
- return s < 0 ? -1 : s > 0 ? 1 : s;
18
- }
19
- export {
20
- l as differenceInDays
21
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./_lib/getRoundingMethod.cjs"),u=require("./_lib/normalizeDates.cjs"),c=require("./constants.cjs");function d(n,t,e){const[r,o]=u.normalizeDates(e?.in,n,t),i=(+r-+o)/c.millisecondsInHour;return s.getRoundingMethod(e?.roundingMethod)(i)}exports.differenceInHours=d;
@@ -1,14 +0,0 @@
1
- import { getRoundingMethod as f } from "./_lib/getRoundingMethod.js";
2
- import { normalizeDates as m } from "./_lib/normalizeDates.js";
3
- import { millisecondsInHour as d } from "./constants.js";
4
- function l(e, o, r) {
5
- const [n, t] = m(
6
- r?.in,
7
- e,
8
- o
9
- ), i = (+n - +t) / d;
10
- return f(r?.roundingMethod)(i);
11
- }
12
- export {
13
- l as differenceInHours
14
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./toDate.cjs");function i(t,n){return+e.toDate(t)-+e.toDate(n)}exports.differenceInMilliseconds=i;
@@ -1,7 +0,0 @@
1
- import { toDate as e } from "./toDate.js";
2
- function t(n, o) {
3
- return +e(n) - +e(o);
4
- }
5
- export {
6
- t as differenceInMilliseconds
7
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./_lib/getRoundingMethod.cjs"),r=require("./constants.cjs"),d=require("./differenceInMilliseconds.cjs");function s(e,n,i){const t=d.differenceInMilliseconds(e,n)/r.millisecondsInMinute;return o.getRoundingMethod(i?.roundingMethod)(t)}exports.differenceInMinutes=s;
@@ -1,10 +0,0 @@
1
- import { getRoundingMethod as r } from "./_lib/getRoundingMethod.js";
2
- import { millisecondsInMinute as t } from "./constants.js";
3
- import { differenceInMilliseconds as f } from "./differenceInMilliseconds.js";
4
- function s(n, e, i) {
5
- const o = f(n, e) / t;
6
- return r(i?.roundingMethod)(o);
7
- }
8
- export {
9
- s as differenceInMinutes
10
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./_lib/normalizeDates.cjs"),s=require("./compareAsc.cjs"),M=require("./differenceInCalendarMonths.cjs"),h=require("./isLastDayOfMonth.cjs");function d(o,f,l){const[a,e,t]=u.normalizeDates(l?.in,o,o,f),r=s.compareAsc(e,t),n=Math.abs(M.differenceInCalendarMonths(e,t));if(n<1)return 0;e.getMonth()===1&&e.getDate()>27&&e.setDate(30),e.setMonth(e.getMonth()-r*n);let i=s.compareAsc(e,t)===-r;h.isLastDayOfMonth(a)&&n===1&&s.compareAsc(a,t)===1&&(i=!1);const c=r*(n-+i);return c===0?0:c}exports.differenceInMonths=d;
@@ -1,23 +0,0 @@
1
- import { normalizeDates as h } from "./_lib/normalizeDates.js";
2
- import { compareAsc as r } from "./compareAsc.js";
3
- import { differenceInCalendarMonths as l } from "./differenceInCalendarMonths.js";
4
- import { isLastDayOfMonth as M } from "./isLastDayOfMonth.js";
5
- function d(i, c, m) {
6
- const [s, t, e] = h(
7
- m?.in,
8
- i,
9
- i,
10
- c
11
- ), o = r(t, e), n = Math.abs(
12
- l(t, e)
13
- );
14
- if (n < 1) return 0;
15
- t.getMonth() === 1 && t.getDate() > 27 && t.setDate(30), t.setMonth(t.getMonth() - o * n);
16
- let a = r(t, e) === -o;
17
- M(s) && n === 1 && r(s, e) === 1 && (a = !1);
18
- const f = o * (n - +a);
19
- return f === 0 ? 0 : f;
20
- }
21
- export {
22
- d as differenceInMonths
23
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./_lib/getRoundingMethod.cjs"),t=require("./differenceInMilliseconds.cjs");function r(e,n,i){const o=t.differenceInMilliseconds(e,n)/1e3;return d.getRoundingMethod(i?.roundingMethod)(o)}exports.differenceInSeconds=r;
@@ -1,9 +0,0 @@
1
- import { getRoundingMethod as r } from "./_lib/getRoundingMethod.js";
2
- import { differenceInMilliseconds as d } from "./differenceInMilliseconds.js";
3
- function c(n, e, o) {
4
- const i = d(n, e) / 1e3;
5
- return r(o?.roundingMethod)(i);
6
- }
7
- export {
8
- c as differenceInSeconds
9
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./_lib/normalizeDates.cjs"),t=require("./compareAsc.cjs"),u=require("./differenceInCalendarYears.cjs");function d(s,c,i){const[e,r]=f.normalizeDates(i?.in,s,c),a=t.compareAsc(e,r),o=Math.abs(u.differenceInCalendarYears(e,r));e.setFullYear(1584),r.setFullYear(1584);const l=t.compareAsc(e,r)===-a,n=a*(o-+l);return n===0?0:n}exports.differenceInYears=d;
@@ -1,16 +0,0 @@
1
- import { normalizeDates as l } from "./_lib/normalizeDates.js";
2
- import { compareAsc as n } from "./compareAsc.js";
3
- import { differenceInCalendarYears as m } from "./differenceInCalendarYears.js";
4
- function Y(o, s, i) {
5
- const [e, r] = l(
6
- i?.in,
7
- o,
8
- s
9
- ), t = n(e, r), c = Math.abs(m(e, r));
10
- e.setFullYear(1584), r.setFullYear(1584);
11
- const f = n(e, r) === -t, a = t * (c - +f);
12
- return a === 0 ? 0 : a;
13
- }
14
- export {
15
- Y as differenceInYears
16
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./toDate.cjs");function n(e,r){const t=o.toDate(e);return t.setHours(23,59,59,999),t}exports.endOfDay=n;
@@ -1,8 +0,0 @@
1
- import { toDate as e } from "./toDate.js";
2
- function s(o, n) {
3
- const t = e(o);
4
- return t.setHours(23, 59, 59, 999), t;
5
- }
6
- export {
7
- s as endOfDay
8
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./toDate.cjs");function r(e,s){const t=n.toDate(e),o=t.getMonth();return t.setFullYear(t.getFullYear(),o+1,0),t.setHours(23,59,59,999),t}exports.endOfMonth=r;
@@ -1,8 +0,0 @@
1
- import { toDate as n } from "./toDate.js";
2
- function u(o, r) {
3
- const t = n(o), e = t.getMonth();
4
- return t.setFullYear(t.getFullYear(), e + 1, 0), t.setHours(23, 59, 59, 999), t;
5
- }
6
- export {
7
- u as endOfMonth
8
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./_lib/normalizeInterval.cjs"),s=require("./add.cjs"),g=require("./differenceInDays.cjs"),M=require("./differenceInHours.cjs"),v=require("./differenceInMinutes.cjs"),D=require("./differenceInMonths.cjs"),S=require("./differenceInSeconds.cjs"),H=require("./differenceInYears.cjs");function T(y,h){const{start:r,end:n}=q.normalizeInterval(h?.in,y),e={},i=H.differenceInYears(n,r);i&&(e.years=i);const o=s.add(r,{years:e.years}),t=D.differenceInMonths(n,o);t&&(e.months=t);const c=s.add(o,{months:e.months}),d=g.differenceInDays(n,c);d&&(e.days=d);const a=s.add(c,{days:e.days}),f=M.differenceInHours(n,a);f&&(e.hours=f);const u=s.add(a,{hours:e.hours}),m=v.differenceInMinutes(n,u);m&&(e.minutes=m);const l=s.add(u,{minutes:e.minutes}),I=S.differenceInSeconds(n,l);return I&&(e.seconds=I),e}exports.intervalToDuration=T;
@@ -1,25 +0,0 @@
1
- import { normalizeInterval as g } from "./_lib/normalizeInterval.js";
2
- import { add as s } from "./add.js";
3
- import { differenceInDays as M } from "./differenceInDays.js";
4
- import { differenceInHours as l } from "./differenceInHours.js";
5
- import { differenceInMinutes as D } from "./differenceInMinutes.js";
6
- import { differenceInMonths as v } from "./differenceInMonths.js";
7
- import { differenceInSeconds as H } from "./differenceInSeconds.js";
8
- import { differenceInYears as S } from "./differenceInYears.js";
9
- function w(y, p) {
10
- const { start: r, end: o } = g(p?.in, y), n = {}, e = S(o, r);
11
- e && (n.years = e);
12
- const i = s(r, { years: n.years }), t = v(o, i);
13
- t && (n.months = t);
14
- const m = s(i, { months: n.months }), f = M(o, m);
15
- f && (n.days = f);
16
- const c = s(m, { days: n.days }), a = l(o, c);
17
- a && (n.hours = a);
18
- const d = s(c, { hours: n.hours }), u = D(o, d);
19
- u && (n.minutes = u);
20
- const I = s(d, { minutes: n.minutes }), h = H(o, I);
21
- return h && (n.seconds = h), n;
22
- }
23
- export {
24
- w as intervalToDuration
25
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./toDate.cjs");function o(e,r){return+t.toDate(e)>+t.toDate(r)}exports.isAfter=o;
@@ -1,7 +0,0 @@
1
- import { toDate as t } from "./toDate.js";
2
- function f(r, o) {
3
- return +t(r) > +t(o);
4
- }
5
- export {
6
- f as isAfter
7
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./endOfDay.cjs"),o=require("./endOfMonth.cjs"),r=require("./toDate.cjs");function a(e,s){const t=r.toDate(e);return+n.endOfDay(t)==+o.endOfMonth(t)}exports.isLastDayOfMonth=a;
@@ -1,10 +0,0 @@
1
- import { endOfDay as n } from "./endOfDay.js";
2
- import { endOfMonth as r } from "./endOfMonth.js";
3
- import { toDate as f } from "./toDate.js";
4
- function p(t, e) {
5
- const o = f(t);
6
- return +n(o) == +r(o);
7
- }
8
- export {
9
- p as isLastDayOfMonth
10
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./toDate.cjs");function r(e,a){const t=o.toDate(e);return t.setHours(0,0,0,0),t}exports.startOfDay=r;
@@ -1,8 +0,0 @@
1
- import { toDate as r } from "./toDate.js";
2
- function s(o, e) {
3
- const t = r(o);
4
- return t.setHours(0, 0, 0, 0), t;
5
- }
6
- export {
7
- s as startOfDay
8
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./constructFrom.cjs");function e(t,r){return o.constructFrom(t,t)}exports.toDate=e;
@@ -1,7 +0,0 @@
1
- import { constructFrom as o } from "./constructFrom.js";
2
- function n(t, r) {
3
- return o(t, t);
4
- }
5
- export {
6
- n as toDate
7
- };