@gobrand/tiempo 2.5.4 → 2.6.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 (73) hide show
  1. package/dist/chunk-5C3TQSWA.js +23 -0
  2. package/dist/chunk-5C3TQSWA.js.map +1 -0
  3. package/dist/{chunk-BBNNR2QH.js → chunk-7VLSSOVC.js} +8 -5
  4. package/dist/{chunk-BBNNR2QH.js.map → chunk-7VLSSOVC.js.map} +1 -1
  5. package/dist/chunk-HFQUXON5.js +41 -0
  6. package/dist/chunk-HFQUXON5.js.map +1 -0
  7. package/dist/chunk-JHRXY36W.js +25 -0
  8. package/dist/chunk-JHRXY36W.js.map +1 -0
  9. package/dist/chunk-MMI2HHT7.js +25 -0
  10. package/dist/chunk-MMI2HHT7.js.map +1 -0
  11. package/dist/chunk-UJW2FPI4.js +25 -0
  12. package/dist/chunk-UJW2FPI4.js.map +1 -0
  13. package/dist/chunk-UJWM2BV2.js +41 -0
  14. package/dist/chunk-UJWM2BV2.js.map +1 -0
  15. package/dist/chunk-WUAIUEH7.js +10 -0
  16. package/dist/chunk-WUAIUEH7.js.map +1 -0
  17. package/dist/chunk-WY63VEXE.js +10 -0
  18. package/dist/chunk-WY63VEXE.js.map +1 -0
  19. package/dist/chunk-ZDA7GSWU.js +19 -0
  20. package/dist/chunk-ZDA7GSWU.js.map +1 -0
  21. package/dist/index.d.ts +4 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +52 -34
  24. package/dist/isAfter.d.ts.map +1 -1
  25. package/dist/isAfter.js +2 -1
  26. package/dist/isBefore.d.ts.map +1 -1
  27. package/dist/isBefore.js +2 -1
  28. package/dist/isWithinInterval.d.ts +71 -0
  29. package/dist/isWithinInterval.d.ts.map +1 -0
  30. package/dist/isWithinInterval.js +10 -0
  31. package/dist/isWithinInterval.js.map +1 -0
  32. package/dist/isWithinInterval.test.d.ts +2 -0
  33. package/dist/isWithinInterval.test.d.ts.map +1 -0
  34. package/dist/roundToNearestHour.d.ts +77 -0
  35. package/dist/roundToNearestHour.d.ts.map +1 -0
  36. package/dist/roundToNearestHour.js +8 -0
  37. package/dist/roundToNearestHour.js.map +1 -0
  38. package/dist/roundToNearestHour.test.d.ts +2 -0
  39. package/dist/roundToNearestHour.test.d.ts.map +1 -0
  40. package/dist/roundToNearestMinute.d.ts +76 -0
  41. package/dist/roundToNearestMinute.d.ts.map +1 -0
  42. package/dist/roundToNearestMinute.js +8 -0
  43. package/dist/roundToNearestMinute.js.map +1 -0
  44. package/dist/roundToNearestMinute.test.d.ts +2 -0
  45. package/dist/roundToNearestMinute.test.d.ts.map +1 -0
  46. package/dist/roundToNearestSecond.d.ts +75 -0
  47. package/dist/roundToNearestSecond.d.ts.map +1 -0
  48. package/dist/roundToNearestSecond.js +8 -0
  49. package/dist/roundToNearestSecond.js.map +1 -0
  50. package/dist/roundToNearestSecond.test.d.ts +2 -0
  51. package/dist/roundToNearestSecond.test.d.ts.map +1 -0
  52. package/dist/shared/isAfter.d.ts +3 -0
  53. package/dist/shared/isAfter.d.ts.map +1 -0
  54. package/dist/shared/isAfter.js +7 -0
  55. package/dist/shared/isAfter.js.map +1 -0
  56. package/dist/shared/isBefore.d.ts +3 -0
  57. package/dist/shared/isBefore.d.ts.map +1 -0
  58. package/dist/shared/isBefore.js +7 -0
  59. package/dist/shared/isBefore.js.map +1 -0
  60. package/dist/toPlainDate.d.ts +14 -7
  61. package/dist/toPlainDate.d.ts.map +1 -1
  62. package/dist/toPlainDate.js +1 -1
  63. package/dist/toPlainTime.d.ts +15 -7
  64. package/dist/toPlainTime.d.ts.map +1 -1
  65. package/dist/toPlainTime.js +1 -1
  66. package/dist/types.d.ts.map +1 -1
  67. package/package.json +1 -1
  68. package/dist/chunk-G45S5B4O.js +0 -25
  69. package/dist/chunk-G45S5B4O.js.map +0 -1
  70. package/dist/chunk-IPJUERCK.js +0 -16
  71. package/dist/chunk-IPJUERCK.js.map +0 -1
  72. package/dist/chunk-UCCWUJ2K.js +0 -25
  73. package/dist/chunk-UCCWUJ2K.js.map +0 -1
@@ -0,0 +1,10 @@
1
+ import {
2
+ isWithinInterval
3
+ } from "./chunk-5C3TQSWA.js";
4
+ import "./chunk-WY63VEXE.js";
5
+ import "./chunk-WUAIUEH7.js";
6
+ import "./chunk-MJSZNWCV.js";
7
+ export {
8
+ isWithinInterval
9
+ };
10
+ //# sourceMappingURL=isWithinInterval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isWithinInterval.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isWithinInterval.test.d.ts","sourceRoot":"","sources":["../src/isWithinInterval.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,77 @@
1
+ import type { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Options for rounding to nearest hour.
4
+ */
5
+ export interface RoundToNearestHourOptions {
6
+ /**
7
+ * The rounding mode to use.
8
+ *
9
+ * Given time 14:20:
10
+ * - `'round'` → 14:00 (20 min < 30, rounds DOWN to nearest)
11
+ * - `'ceil'` → 15:00 (always rounds UP to next hour)
12
+ * - `'floor'` → 14:00 (always rounds DOWN to current hour)
13
+ *
14
+ * Given time 14:40:
15
+ * - `'round'` → 15:00 (40 min >= 30, rounds UP to nearest)
16
+ * - `'ceil'` → 15:00 (always rounds UP to next hour)
17
+ * - `'floor'` → 14:00 (always rounds DOWN to current hour)
18
+ *
19
+ * @default 'round'
20
+ */
21
+ mode?: 'round' | 'ceil' | 'floor';
22
+ /**
23
+ * Round to the nearest N hours. Must divide evenly into 24.
24
+ * Valid values: 1, 2, 3, 4, 6, 8, 12
25
+ * @example nearestTo: 6 rounds to 00:00, 06:00, 12:00, or 18:00
26
+ */
27
+ nearestTo?: 1 | 2 | 3 | 4 | 6 | 8 | 12;
28
+ }
29
+ /**
30
+ * Rounds a datetime to the nearest hour boundary.
31
+ *
32
+ * ## Mode comparison (given 14:20)
33
+ *
34
+ * ```
35
+ * 14:00 ─────────────●───────────────── 15:00
36
+ * 14:20
37
+ *
38
+ * 'round' → 14:00 (nearest hour - 20 min < 30)
39
+ * 'ceil' → 15:00 (next hour - always up)
40
+ * 'floor' → 14:00 (current hour - always down)
41
+ * ```
42
+ *
43
+ * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime
44
+ * @param options - Rounding options
45
+ * @returns ZonedDateTime rounded to the hour boundary
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const time = Temporal.ZonedDateTime.from('2025-01-20T14:20:00[America/New_York]');
50
+ *
51
+ * roundToNearestHour(time); // → 14:00 (nearest)
52
+ * roundToNearestHour(time, { mode: 'ceil' }); // → 15:00 (always up)
53
+ * roundToNearestHour(time, { mode: 'floor' }); // → 14:00 (always down)
54
+ * ```
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * // With 37 minutes (past the halfway point)
59
+ * const time = Temporal.ZonedDateTime.from('2025-01-20T14:37:00[America/New_York]');
60
+ *
61
+ * roundToNearestHour(time); // → 15:00 (nearest - 37 >= 30)
62
+ * roundToNearestHour(time, { mode: 'ceil' }); // → 15:00 (always up)
63
+ * roundToNearestHour(time, { mode: 'floor' }); // → 14:00 (always down)
64
+ * ```
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * // Round to 6-hour blocks (shift scheduling)
69
+ * const time = Temporal.ZonedDateTime.from('2025-01-20T14:00:00[America/New_York]');
70
+ *
71
+ * roundToNearestHour(time, { nearestTo: 6 }); // → 12:00
72
+ * roundToNearestHour(time, { mode: 'ceil', nearestTo: 6 }); // → 18:00
73
+ * roundToNearestHour(time, { mode: 'floor', nearestTo: 6 }); // → 12:00
74
+ * ```
75
+ */
76
+ export declare function roundToNearestHour(input: Temporal.Instant | Temporal.ZonedDateTime, options?: RoundToNearestHourOptions): Temporal.ZonedDateTime;
77
+ //# sourceMappingURL=roundToNearestHour.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToNearestHour.d.ts","sourceRoot":"","sources":["../src/roundToNearestHour.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;CACxC;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,OAAO,CAAC,EAAE,yBAAyB,GAClC,QAAQ,CAAC,aAAa,CAUxB"}
@@ -0,0 +1,8 @@
1
+ import {
2
+ roundToNearestHour
3
+ } from "./chunk-MMI2HHT7.js";
4
+ import "./chunk-MJSZNWCV.js";
5
+ export {
6
+ roundToNearestHour
7
+ };
8
+ //# sourceMappingURL=roundToNearestHour.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=roundToNearestHour.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToNearestHour.test.d.ts","sourceRoot":"","sources":["../src/roundToNearestHour.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,76 @@
1
+ import type { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Options for rounding to nearest minute.
4
+ */
5
+ export interface RoundToNearestMinuteOptions {
6
+ /**
7
+ * The rounding mode to use.
8
+ *
9
+ * Given time 14:37:20:
10
+ * - `'round'` → 14:37 (20 sec < 30, rounds DOWN to nearest)
11
+ * - `'ceil'` → 14:38 (always rounds UP to next minute)
12
+ * - `'floor'` → 14:37 (always rounds DOWN to current minute)
13
+ *
14
+ * Given time 14:37:00 with nearestTo: 15:
15
+ * - `'round'` → 14:30 (37 is closer to 30 than 45)
16
+ * - `'ceil'` → 14:45 (always rounds UP to next 15-min slot)
17
+ * - `'floor'` → 14:30 (always rounds DOWN to current 15-min slot)
18
+ *
19
+ * @default 'round'
20
+ */
21
+ mode?: 'round' | 'ceil' | 'floor';
22
+ /**
23
+ * Round to the nearest N minutes. Must divide evenly into 60.
24
+ * Valid values: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30
25
+ * @example nearestTo: 15 rounds to quarter-hour marks (00, 15, 30, 45)
26
+ */
27
+ nearestTo?: 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30;
28
+ }
29
+ /**
30
+ * Rounds a datetime to the nearest minute boundary.
31
+ *
32
+ * ## Mode comparison (given 14:37 with 15-min slots)
33
+ *
34
+ * ```
35
+ * 14:30 ─────────●───────────────────── 14:45
36
+ * 14:37
37
+ *
38
+ * 'round' → 14:30 (nearest slot - 37 is closer to 30 than 45)
39
+ * 'ceil' → 14:45 (next slot - always up)
40
+ * 'floor' → 14:30 (current slot - always down)
41
+ * ```
42
+ *
43
+ * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime
44
+ * @param options - Rounding options
45
+ * @returns ZonedDateTime rounded to the minute boundary
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * // 15-minute booking slots at 14:37
50
+ * const time = Temporal.ZonedDateTime.from('2025-01-20T14:37:00[America/New_York]');
51
+ *
52
+ * roundToNearestMinute(time, { nearestTo: 15 }); // → 14:30 (nearest)
53
+ * roundToNearestMinute(time, { mode: 'ceil', nearestTo: 15 }); // → 14:45 (next slot)
54
+ * roundToNearestMinute(time, { mode: 'floor', nearestTo: 15 }); // → 14:30 (current slot)
55
+ * ```
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * // Basic minute rounding (no slots)
60
+ * const time = Temporal.ZonedDateTime.from('2025-01-20T14:37:42[America/New_York]');
61
+ *
62
+ * roundToNearestMinute(time); // → 14:38 (42 sec >= 30)
63
+ * roundToNearestMinute(time, { mode: 'ceil' }); // → 14:38 (always up)
64
+ * roundToNearestMinute(time, { mode: 'floor' }); // → 14:37 (always down)
65
+ * ```
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * // Billing: round up to 30-minute increments
70
+ * const sessionEnd = Temporal.ZonedDateTime.from('2025-01-20T11:07:00[America/New_York]');
71
+ * roundToNearestMinute(sessionEnd, { mode: 'ceil', nearestTo: 30 });
72
+ * // → 11:30 (bill for 30 mins even though session was 7 mins)
73
+ * ```
74
+ */
75
+ export declare function roundToNearestMinute(input: Temporal.Instant | Temporal.ZonedDateTime, options?: RoundToNearestMinuteOptions): Temporal.ZonedDateTime;
76
+ //# sourceMappingURL=roundToNearestMinute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToNearestMinute.d.ts","sourceRoot":"","sources":["../src/roundToNearestMinute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;CAC5D;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,OAAO,CAAC,EAAE,2BAA2B,GACpC,QAAQ,CAAC,aAAa,CAUxB"}
@@ -0,0 +1,8 @@
1
+ import {
2
+ roundToNearestMinute
3
+ } from "./chunk-UJW2FPI4.js";
4
+ import "./chunk-MJSZNWCV.js";
5
+ export {
6
+ roundToNearestMinute
7
+ };
8
+ //# sourceMappingURL=roundToNearestMinute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=roundToNearestMinute.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToNearestMinute.test.d.ts","sourceRoot":"","sources":["../src/roundToNearestMinute.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ import type { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Options for rounding to nearest second.
4
+ */
5
+ export interface RoundToNearestSecondOptions {
6
+ /**
7
+ * The rounding mode to use.
8
+ *
9
+ * Given time 14:37:42.300:
10
+ * - `'round'` → 14:37:42 (300ms < 500, rounds DOWN to nearest)
11
+ * - `'ceil'` → 14:37:43 (always rounds UP to next second)
12
+ * - `'floor'` → 14:37:42 (always rounds DOWN to current second)
13
+ *
14
+ * Given time 14:37:42 with nearestTo: 10:
15
+ * - `'round'` → 14:37:40 (42 is closer to 40 than 50)
16
+ * - `'ceil'` → 14:37:50 (always rounds UP to next 10-sec mark)
17
+ * - `'floor'` → 14:37:40 (always rounds DOWN to current 10-sec mark)
18
+ *
19
+ * @default 'round'
20
+ */
21
+ mode?: 'round' | 'ceil' | 'floor';
22
+ /**
23
+ * Round to the nearest N seconds. Must divide evenly into 60.
24
+ * Valid values: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30
25
+ * @example nearestTo: 10 rounds to 10-second marks (00, 10, 20, 30, 40, 50)
26
+ */
27
+ nearestTo?: 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30;
28
+ }
29
+ /**
30
+ * Rounds a datetime to the nearest second boundary.
31
+ *
32
+ * ## Mode comparison (given 14:37:42.567)
33
+ *
34
+ * ```
35
+ * :42 ─────────────────●─────────────── :43
36
+ * .567
37
+ *
38
+ * 'round' → :43 (nearest second - 567ms >= 500)
39
+ * 'ceil' → :43 (next second - always up)
40
+ * 'floor' → :42 (current second - always down)
41
+ * ```
42
+ *
43
+ * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime
44
+ * @param options - Rounding options
45
+ * @returns ZonedDateTime rounded to the second boundary
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const time = Temporal.ZonedDateTime.from('2025-01-20T14:37:42.567[America/New_York]');
50
+ *
51
+ * roundToNearestSecond(time); // → 14:37:43 (567ms >= 500)
52
+ * roundToNearestSecond(time, { mode: 'ceil' }); // → 14:37:43 (always up)
53
+ * roundToNearestSecond(time, { mode: 'floor' }); // → 14:37:42 (always down)
54
+ * ```
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * // 10-second intervals
59
+ * const time = Temporal.ZonedDateTime.from('2025-01-20T14:37:42[America/New_York]');
60
+ *
61
+ * roundToNearestSecond(time, { nearestTo: 10 }); // → 14:37:40 (nearest)
62
+ * roundToNearestSecond(time, { mode: 'ceil', nearestTo: 10 }); // → 14:37:50 (next 10s)
63
+ * roundToNearestSecond(time, { mode: 'floor', nearestTo: 10 }); // → 14:37:40 (current 10s)
64
+ * ```
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * // Remove sub-second precision for logging
69
+ * const logTime = Temporal.ZonedDateTime.from('2025-01-20T14:37:42.123456789[UTC]');
70
+ * roundToNearestSecond(logTime, { mode: 'floor' });
71
+ * // → 14:37:42.000000000 (clean timestamp)
72
+ * ```
73
+ */
74
+ export declare function roundToNearestSecond(input: Temporal.Instant | Temporal.ZonedDateTime, options?: RoundToNearestSecondOptions): Temporal.ZonedDateTime;
75
+ //# sourceMappingURL=roundToNearestSecond.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToNearestSecond.d.ts","sourceRoot":"","sources":["../src/roundToNearestSecond.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;CAC5D;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,OAAO,CAAC,EAAE,2BAA2B,GACpC,QAAQ,CAAC,aAAa,CAUxB"}
@@ -0,0 +1,8 @@
1
+ import {
2
+ roundToNearestSecond
3
+ } from "./chunk-JHRXY36W.js";
4
+ import "./chunk-MJSZNWCV.js";
5
+ export {
6
+ roundToNearestSecond
7
+ };
8
+ //# sourceMappingURL=roundToNearestSecond.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=roundToNearestSecond.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundToNearestSecond.test.d.ts","sourceRoot":"","sources":["../src/roundToNearestSecond.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ export declare function isAfter(date1: Temporal.ZonedDateTime, date2: Temporal.ZonedDateTime): boolean;
3
+ //# sourceMappingURL=isAfter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isAfter.d.ts","sourceRoot":"","sources":["../../src/shared/isAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,wBAAgB,OAAO,CACrB,KAAK,EAAE,QAAQ,CAAC,aAAa,EAC7B,KAAK,EAAE,QAAQ,CAAC,aAAa,GAC5B,OAAO,CAET"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ isAfter
3
+ } from "../chunk-WY63VEXE.js";
4
+ export {
5
+ isAfter
6
+ };
7
+ //# sourceMappingURL=isAfter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ export declare function isBefore(date1: Temporal.ZonedDateTime, date2: Temporal.ZonedDateTime): boolean;
3
+ //# sourceMappingURL=isBefore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isBefore.d.ts","sourceRoot":"","sources":["../../src/shared/isBefore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,QAAQ,CAAC,aAAa,EAC7B,KAAK,EAAE,QAAQ,CAAC,aAAa,GAC5B,OAAO,CAET"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ isBefore
3
+ } from "../chunk-WUAIUEH7.js";
4
+ export {
5
+ isBefore
6
+ };
7
+ //# sourceMappingURL=isBefore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,31 +1,38 @@
1
1
  import { Temporal } from '@js-temporal/polyfill';
2
2
  import type { Timezone } from './types';
3
3
  /**
4
- * Extract the calendar date from a ZonedDateTime or convert an input to a timezone and extract the date.
4
+ * Parse a plain date or extract the calendar date from a datetime.
5
5
  *
6
- * @param input - A Temporal.ZonedDateTime (timezone optional) or a UTC ISO string, Date, Instant, or ZonedDateTime (timezone required)
7
- * @param timezone - IANA timezone identifier. Required unless input is a ZonedDateTime.
6
+ * @param input - A PlainDateLike object, plain date string (YYYY-MM-DD), ZonedDateTime, or datetime input requiring timezone
7
+ * @param timezone - IANA timezone identifier. Required for ISO strings, Date, and Instant inputs.
8
8
  * @returns A Temporal.PlainDate representing the calendar date
9
9
  *
10
10
  * @example
11
11
  * ```typescript
12
12
  * import { toPlainDate, toZonedTime } from '@gobrand/tiempo';
13
13
  *
14
+ * // From PlainDateLike object (no timezone needed)
15
+ * const date = toPlainDate({ year: 2025, month: 1, day: 20 }); // 2025-01-20
16
+ *
17
+ * // From plain date string (no timezone needed)
18
+ * const date2 = toPlainDate("2025-01-20"); // 2025-01-20
19
+ *
14
20
  * // From ZonedDateTime (no timezone needed)
15
21
  * const zdt = toZonedTime("2025-01-20T15:30:00Z", "America/New_York");
16
- * const date = toPlainDate(zdt); // 2025-01-20
22
+ * const date3 = toPlainDate(zdt); // 2025-01-20
17
23
  *
18
24
  * // From UTC string with timezone
19
- * const date2 = toPlainDate("2025-01-20T15:30:00Z", "America/New_York"); // 2025-01-20
25
+ * const date4 = toPlainDate("2025-01-20T15:30:00Z", "America/New_York"); // 2025-01-20
20
26
  *
21
27
  * // From Date with timezone
22
28
  * const jsDate = new Date("2025-01-20T15:30:00.000Z");
23
- * const date3 = toPlainDate(jsDate, "Europe/London"); // 2025-01-20
29
+ * const date5 = toPlainDate(jsDate, "Europe/London"); // 2025-01-20
24
30
  *
25
31
  * // Date boundary crossing: 23:00 UTC on Jan 20 → Jan 21 in Tokyo
26
- * const date4 = toPlainDate("2025-01-20T23:00:00Z", "Asia/Tokyo"); // 2025-01-21
32
+ * const date6 = toPlainDate("2025-01-20T23:00:00Z", "Asia/Tokyo"); // 2025-01-21
27
33
  * ```
28
34
  */
29
35
  export declare function toPlainDate(input: Temporal.ZonedDateTime): Temporal.PlainDate;
30
36
  export declare function toPlainDate(input: string | Date | Temporal.Instant | Temporal.ZonedDateTime, timezone: Timezone): Temporal.PlainDate;
37
+ export declare function toPlainDate(input: Temporal.PlainDateLike | string): Temporal.PlainDate;
31
38
  //# sourceMappingURL=toPlainDate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toPlainDate.d.ts","sourceRoot":"","sources":["../src/toPlainDate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC/E,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChE,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,SAAS,CAAC"}
1
+ {"version":3,"file":"toPlainDate.d.ts","sourceRoot":"","sources":["../src/toPlainDate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC/E,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChE,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,SAAS,CAAC;AACtB,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toPlainDate
3
- } from "./chunk-UCCWUJ2K.js";
3
+ } from "./chunk-HFQUXON5.js";
4
4
  export {
5
5
  toPlainDate
6
6
  };
@@ -1,32 +1,40 @@
1
1
  import { Temporal } from '@js-temporal/polyfill';
2
2
  import type { Timezone } from './types';
3
3
  /**
4
- * Extract the wall-clock time from a ZonedDateTime or convert an input to a timezone and extract the time.
4
+ * Parse a plain time or extract the wall-clock time from a datetime.
5
5
  *
6
- * @param input - A Temporal.ZonedDateTime (timezone optional) or a UTC ISO string, Date, Instant, or ZonedDateTime (timezone required)
7
- * @param timezone - IANA timezone identifier. Required unless input is a ZonedDateTime.
6
+ * @param input - A PlainTimeLike object, plain time string (HH:MM or HH:MM:SS), ZonedDateTime, or datetime input requiring timezone
7
+ * @param timezone - IANA timezone identifier. Required for ISO strings, Date, and Instant inputs.
8
8
  * @returns A Temporal.PlainTime representing the wall-clock time
9
9
  *
10
10
  * @example
11
11
  * ```typescript
12
12
  * import { toPlainTime, toZonedTime } from '@gobrand/tiempo';
13
13
  *
14
+ * // From PlainTimeLike object (no timezone needed)
15
+ * const time = toPlainTime({ hour: 14, minute: 30 }); // 14:30
16
+ *
17
+ * // From plain time string (no timezone needed)
18
+ * const time2 = toPlainTime("14:30"); // 14:30
19
+ * const timeWithSeconds = toPlainTime("14:30:45"); // 14:30:45
20
+ *
14
21
  * // From ZonedDateTime (no timezone needed)
15
22
  * const zdt = toZonedTime("2025-01-20T15:30:00Z", "America/New_York");
16
- * const time = toPlainTime(zdt); // 10:30
23
+ * const time3 = toPlainTime(zdt); // 10:30
17
24
  *
18
25
  * // From UTC string with timezone
19
- * const time2 = toPlainTime("2025-01-20T15:30:00Z", "America/New_York"); // 10:30
26
+ * const time4 = toPlainTime("2025-01-20T15:30:00Z", "America/New_York"); // 10:30
20
27
  *
21
28
  * // From Date with timezone
22
29
  * const date = new Date("2025-01-20T15:30:00.000Z");
23
- * const time3 = toPlainTime(date, "Europe/London"); // 15:30
30
+ * const time5 = toPlainTime(date, "Europe/London"); // 15:30
24
31
  *
25
32
  * // From Instant with timezone
26
33
  * const instant = Temporal.Instant.from("2025-01-20T15:30:00Z");
27
- * const time4 = toPlainTime(instant, "Asia/Tokyo"); // 00:30
34
+ * const time6 = toPlainTime(instant, "Asia/Tokyo"); // 00:30
28
35
  * ```
29
36
  */
30
37
  export declare function toPlainTime(input: Temporal.ZonedDateTime): Temporal.PlainTime;
31
38
  export declare function toPlainTime(input: string | Date | Temporal.Instant | Temporal.ZonedDateTime, timezone: Timezone): Temporal.PlainTime;
39
+ export declare function toPlainTime(input: Temporal.PlainTimeLike | string): Temporal.PlainTime;
32
40
  //# sourceMappingURL=toPlainTime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toPlainTime.d.ts","sourceRoot":"","sources":["../src/toPlainTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC/E,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChE,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,SAAS,CAAC"}
1
+ {"version":3,"file":"toPlainTime.d.ts","sourceRoot":"","sources":["../src/toPlainTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC/E,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChE,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,SAAS,CAAC;AACtB,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toPlainTime
3
- } from "./chunk-G45S5B4O.js";
3
+ } from "./chunk-UJWM2BV2.js";
4
4
  export {
5
5
  toPlainTime
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,YAAY,CAAC;AAE5C,YAAY,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,YAAY,CAAC;AAE5C,YAAY,EAAE,YAAY,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobrand/tiempo",
3
- "version": "2.5.4",
3
+ "version": "2.6.1",
4
4
  "description": "Lightweight utility functions for converting between UTC and timezone-aware datetimes using the Temporal API",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -1,25 +0,0 @@
1
- // src/toPlainTime.ts
2
- import { Temporal } from "@js-temporal/polyfill";
3
- function toPlainTime(input, timezone) {
4
- if (input instanceof Temporal.ZonedDateTime && timezone === void 0) {
5
- return input.toPlainTime();
6
- }
7
- if (timezone === void 0) {
8
- throw new Error("Timezone is required unless input is a ZonedDateTime");
9
- }
10
- if (typeof input === "string") {
11
- return Temporal.Instant.from(input).toZonedDateTimeISO(timezone).toPlainTime();
12
- }
13
- if (input instanceof Date) {
14
- return Temporal.Instant.from(input.toISOString()).toZonedDateTimeISO(timezone).toPlainTime();
15
- }
16
- if (input instanceof Temporal.Instant) {
17
- return input.toZonedDateTimeISO(timezone).toPlainTime();
18
- }
19
- return input.toInstant().toZonedDateTimeISO(timezone).toPlainTime();
20
- }
21
-
22
- export {
23
- toPlainTime
24
- };
25
- //# sourceMappingURL=chunk-G45S5B4O.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/toPlainTime.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\n\n/**\n * Extract the wall-clock time from a ZonedDateTime or convert an input to a timezone and extract the time.\n *\n * @param input - A Temporal.ZonedDateTime (timezone optional) or a UTC ISO string, Date, Instant, or ZonedDateTime (timezone required)\n * @param timezone - IANA timezone identifier. Required unless input is a ZonedDateTime.\n * @returns A Temporal.PlainTime representing the wall-clock time\n *\n * @example\n * ```typescript\n * import { toPlainTime, toZonedTime } from '@gobrand/tiempo';\n *\n * // From ZonedDateTime (no timezone needed)\n * const zdt = toZonedTime(\"2025-01-20T15:30:00Z\", \"America/New_York\");\n * const time = toPlainTime(zdt); // 10:30\n *\n * // From UTC string with timezone\n * const time2 = toPlainTime(\"2025-01-20T15:30:00Z\", \"America/New_York\"); // 10:30\n *\n * // From Date with timezone\n * const date = new Date(\"2025-01-20T15:30:00.000Z\");\n * const time3 = toPlainTime(date, \"Europe/London\"); // 15:30\n *\n * // From Instant with timezone\n * const instant = Temporal.Instant.from(\"2025-01-20T15:30:00Z\");\n * const time4 = toPlainTime(instant, \"Asia/Tokyo\"); // 00:30\n * ```\n */\nexport function toPlainTime(input: Temporal.ZonedDateTime): Temporal.PlainTime;\nexport function toPlainTime(\n input: string | Date | Temporal.Instant | Temporal.ZonedDateTime,\n timezone: Timezone\n): Temporal.PlainTime;\nexport function toPlainTime(\n input: string | Date | Temporal.Instant | Temporal.ZonedDateTime,\n timezone?: Timezone\n): Temporal.PlainTime {\n if (input instanceof Temporal.ZonedDateTime && timezone === undefined) {\n return input.toPlainTime();\n }\n\n if (timezone === undefined) {\n throw new Error('Timezone is required unless input is a ZonedDateTime');\n }\n\n if (typeof input === 'string') {\n return Temporal.Instant.from(input).toZonedDateTimeISO(timezone).toPlainTime();\n }\n\n if (input instanceof Date) {\n return Temporal.Instant.from(input.toISOString()).toZonedDateTimeISO(timezone).toPlainTime();\n }\n\n if (input instanceof Temporal.Instant) {\n return input.toZonedDateTimeISO(timezone).toPlainTime();\n }\n\n return input.toInstant().toZonedDateTimeISO(timezone).toPlainTime();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAmClB,SAAS,YACd,OACA,UACoB;AACpB,MAAI,iBAAiB,SAAS,iBAAiB,aAAa,QAAW;AACrE,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,MAAI,aAAa,QAAW;AAC1B,UAAM,IAAI,MAAM,sDAAsD;AAAA,EACxE;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,SAAS,QAAQ,KAAK,KAAK,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EAC/E;AAEA,MAAI,iBAAiB,MAAM;AACzB,WAAO,SAAS,QAAQ,KAAK,MAAM,YAAY,CAAC,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EAC7F;AAEA,MAAI,iBAAiB,SAAS,SAAS;AACrC,WAAO,MAAM,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EACxD;AAEA,SAAO,MAAM,UAAU,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AACpE;","names":[]}
@@ -1,16 +0,0 @@
1
- import {
2
- normalizeTemporalInput
3
- } from "./chunk-MJSZNWCV.js";
4
-
5
- // src/isBefore.ts
6
- import { Temporal } from "@js-temporal/polyfill";
7
- function isBefore(date1, date2) {
8
- const zoned1 = normalizeTemporalInput(date1);
9
- const zoned2 = normalizeTemporalInput(date2);
10
- return Temporal.ZonedDateTime.compare(zoned1, zoned2) < 0;
11
- }
12
-
13
- export {
14
- isBefore
15
- };
16
- //# sourceMappingURL=chunk-IPJUERCK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/isBefore.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns true if the first datetime is before the second datetime.\n * Compares by the underlying instant (epoch time), not by calendar date/time.\n *\n * @param date1 - First datetime (Instant or ZonedDateTime)\n * @param date2 - Second datetime (Instant or ZonedDateTime)\n * @returns true if date1 is before date2, false otherwise\n *\n * @example\n * ```ts\n * const earlier = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');\n * const later = Temporal.ZonedDateTime.from('2025-01-20T16:00:00-05:00[America/New_York]');\n *\n * isBefore(earlier, later); // true\n * isBefore(later, earlier); // false\n * isBefore(earlier, earlier); // false\n * ```\n *\n * @example\n * ```ts\n * // Works with Instant too\n * const instant1 = Temporal.Instant.from('2025-01-20T15:00:00Z');\n * const instant2 = Temporal.Instant.from('2025-01-20T16:00:00Z');\n *\n * isBefore(instant1, instant2); // true\n * ```\n *\n * @example\n * ```ts\n * // Different timezones - compares by instant\n * const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');\n * const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');\n *\n * isBefore(ny, tokyo); // true\n * // NY 10:00 is 15:00 UTC, Tokyo 00:00 is 15:00 UTC the previous day\n * ```\n */\nexport function isBefore(\n date1: Temporal.Instant | Temporal.ZonedDateTime,\n date2: Temporal.Instant | Temporal.ZonedDateTime\n): boolean {\n const zoned1 = normalizeTemporalInput(date1);\n const zoned2 = normalizeTemporalInput(date2);\n\n return Temporal.ZonedDateTime.compare(zoned1, zoned2) < 0;\n}\n"],"mappings":";;;;;AAAA,SAAS,gBAAgB;AAwClB,SAAS,SACd,OACA,OACS;AACT,QAAM,SAAS,uBAAuB,KAAK;AAC3C,QAAM,SAAS,uBAAuB,KAAK;AAE3C,SAAO,SAAS,cAAc,QAAQ,QAAQ,MAAM,IAAI;AAC1D;","names":[]}
@@ -1,25 +0,0 @@
1
- // src/toPlainDate.ts
2
- import { Temporal } from "@js-temporal/polyfill";
3
- function toPlainDate(input, timezone) {
4
- if (input instanceof Temporal.ZonedDateTime && timezone === void 0) {
5
- return input.toPlainDate();
6
- }
7
- if (timezone === void 0) {
8
- throw new Error("Timezone is required unless input is a ZonedDateTime");
9
- }
10
- if (typeof input === "string") {
11
- return Temporal.Instant.from(input).toZonedDateTimeISO(timezone).toPlainDate();
12
- }
13
- if (input instanceof Date) {
14
- return Temporal.Instant.from(input.toISOString()).toZonedDateTimeISO(timezone).toPlainDate();
15
- }
16
- if (input instanceof Temporal.Instant) {
17
- return input.toZonedDateTimeISO(timezone).toPlainDate();
18
- }
19
- return input.toInstant().toZonedDateTimeISO(timezone).toPlainDate();
20
- }
21
-
22
- export {
23
- toPlainDate
24
- };
25
- //# sourceMappingURL=chunk-UCCWUJ2K.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/toPlainDate.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\n\n/**\n * Extract the calendar date from a ZonedDateTime or convert an input to a timezone and extract the date.\n *\n * @param input - A Temporal.ZonedDateTime (timezone optional) or a UTC ISO string, Date, Instant, or ZonedDateTime (timezone required)\n * @param timezone - IANA timezone identifier. Required unless input is a ZonedDateTime.\n * @returns A Temporal.PlainDate representing the calendar date\n *\n * @example\n * ```typescript\n * import { toPlainDate, toZonedTime } from '@gobrand/tiempo';\n *\n * // From ZonedDateTime (no timezone needed)\n * const zdt = toZonedTime(\"2025-01-20T15:30:00Z\", \"America/New_York\");\n * const date = toPlainDate(zdt); // 2025-01-20\n *\n * // From UTC string with timezone\n * const date2 = toPlainDate(\"2025-01-20T15:30:00Z\", \"America/New_York\"); // 2025-01-20\n *\n * // From Date with timezone\n * const jsDate = new Date(\"2025-01-20T15:30:00.000Z\");\n * const date3 = toPlainDate(jsDate, \"Europe/London\"); // 2025-01-20\n *\n * // Date boundary crossing: 23:00 UTC on Jan 20 → Jan 21 in Tokyo\n * const date4 = toPlainDate(\"2025-01-20T23:00:00Z\", \"Asia/Tokyo\"); // 2025-01-21\n * ```\n */\nexport function toPlainDate(input: Temporal.ZonedDateTime): Temporal.PlainDate;\nexport function toPlainDate(\n input: string | Date | Temporal.Instant | Temporal.ZonedDateTime,\n timezone: Timezone\n): Temporal.PlainDate;\nexport function toPlainDate(\n input: string | Date | Temporal.Instant | Temporal.ZonedDateTime,\n timezone?: Timezone\n): Temporal.PlainDate {\n if (input instanceof Temporal.ZonedDateTime && timezone === undefined) {\n return input.toPlainDate();\n }\n\n if (timezone === undefined) {\n throw new Error('Timezone is required unless input is a ZonedDateTime');\n }\n\n if (typeof input === 'string') {\n return Temporal.Instant.from(input).toZonedDateTimeISO(timezone).toPlainDate();\n }\n\n if (input instanceof Date) {\n return Temporal.Instant.from(input.toISOString()).toZonedDateTimeISO(timezone).toPlainDate();\n }\n\n if (input instanceof Temporal.Instant) {\n return input.toZonedDateTimeISO(timezone).toPlainDate();\n }\n\n return input.toInstant().toZonedDateTimeISO(timezone).toPlainDate();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAkClB,SAAS,YACd,OACA,UACoB;AACpB,MAAI,iBAAiB,SAAS,iBAAiB,aAAa,QAAW;AACrE,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,MAAI,aAAa,QAAW;AAC1B,UAAM,IAAI,MAAM,sDAAsD;AAAA,EACxE;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,SAAS,QAAQ,KAAK,KAAK,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EAC/E;AAEA,MAAI,iBAAiB,MAAM;AACzB,WAAO,SAAS,QAAQ,KAAK,MAAM,YAAY,CAAC,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EAC7F;AAEA,MAAI,iBAAiB,SAAS,SAAS;AACrC,WAAO,MAAM,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EACxD;AAEA,SAAO,MAAM,UAAU,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AACpE;","names":[]}