@gobrand/tiempo 2.5.0 → 2.5.2

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 (37) hide show
  1. package/README.md +4 -3
  2. package/dist/chunk-AJEIDKVJ.js +10 -0
  3. package/dist/chunk-AJEIDKVJ.js.map +1 -0
  4. package/dist/chunk-G45S5B4O.js +25 -0
  5. package/dist/chunk-G45S5B4O.js.map +1 -0
  6. package/dist/chunk-RBEW6PXR.js +10 -0
  7. package/dist/chunk-RBEW6PXR.js.map +1 -0
  8. package/dist/chunk-VZJGCDAG.js +10 -0
  9. package/dist/chunk-VZJGCDAG.js.map +1 -0
  10. package/dist/index.d.ts +4 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +45 -29
  13. package/dist/isPlainTimeAfter.d.ts +21 -0
  14. package/dist/isPlainTimeAfter.d.ts.map +1 -0
  15. package/dist/isPlainTimeAfter.js +7 -0
  16. package/dist/isPlainTimeAfter.js.map +1 -0
  17. package/dist/isPlainTimeAfter.test.d.ts +2 -0
  18. package/dist/isPlainTimeAfter.test.d.ts.map +1 -0
  19. package/dist/isPlainTimeBefore.d.ts +21 -0
  20. package/dist/isPlainTimeBefore.d.ts.map +1 -0
  21. package/dist/isPlainTimeBefore.js +7 -0
  22. package/dist/isPlainTimeBefore.js.map +1 -0
  23. package/dist/isPlainTimeBefore.test.d.ts +2 -0
  24. package/dist/isPlainTimeBefore.test.d.ts.map +1 -0
  25. package/dist/isPlainTimeEqual.d.ts +21 -0
  26. package/dist/isPlainTimeEqual.d.ts.map +1 -0
  27. package/dist/isPlainTimeEqual.js +7 -0
  28. package/dist/isPlainTimeEqual.js.map +1 -0
  29. package/dist/isPlainTimeEqual.test.d.ts +2 -0
  30. package/dist/isPlainTimeEqual.test.d.ts.map +1 -0
  31. package/dist/toPlainTime.d.ts +32 -0
  32. package/dist/toPlainTime.d.ts.map +1 -0
  33. package/dist/toPlainTime.js +7 -0
  34. package/dist/toPlainTime.js.map +1 -0
  35. package/dist/toPlainTime.test.d.ts +2 -0
  36. package/dist/toPlainTime.test.d.ts.map +1 -0
  37. package/package.json +1 -1
package/README.md CHANGED
@@ -1,15 +1,16 @@
1
- # @gobrand/tiempo
1
+ # tiempo
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@gobrand/tiempo.svg)](https://www.npmjs.com/package/@gobrand/tiempo)
4
4
  [![CI](https://github.com/go-brand/tiempo/actions/workflows/ci.yml/badge.svg)](https://github.com/go-brand/tiempo/actions/workflows/ci.yml)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
 
7
- ![tiempo banner](./tiempo_banner.png)
8
-
9
7
  **Timezone conversions that don't suck.** Built on the [Temporal API](https://tc39.es/proposal-temporal/docs/).
10
8
 
11
9
  👉 **[Documentation](https://eng.gobrand.app/tiempo)**
12
10
 
11
+ ![tiempo banner](./tiempo_banner.png)
12
+
13
+
13
14
  - **Zero timezone bugs** - Real IANA timezone support, not UTC offset hacks
14
15
  - **DST-aware math** - `addDays(1)` means tomorrow, even across clock changes
15
16
  - **Nanosecond precision** - When milliseconds aren't enough
@@ -0,0 +1,10 @@
1
+ // src/isPlainTimeBefore.ts
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ function isPlainTimeBefore(time1, time2) {
4
+ return Temporal.PlainTime.compare(time1, time2) < 0;
5
+ }
6
+
7
+ export {
8
+ isPlainTimeBefore
9
+ };
10
+ //# sourceMappingURL=chunk-AJEIDKVJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/isPlainTimeBefore.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\n\n/**\n * Returns true if the first plain time is before the second plain time.\n * Compares wall-clock times without date or timezone considerations.\n *\n * @param time1 - First plain time\n * @param time2 - Second plain time\n * @returns true if time1 is before time2, false otherwise\n *\n * @example\n * ```ts\n * const morning = Temporal.PlainTime.from('09:00');\n * const evening = Temporal.PlainTime.from('17:00');\n *\n * isPlainTimeBefore(morning, evening); // true\n * isPlainTimeBefore(evening, morning); // false\n * isPlainTimeBefore(morning, morning); // false\n * ```\n */\nexport function isPlainTimeBefore(\n time1: Temporal.PlainTime,\n time2: Temporal.PlainTime\n): boolean {\n return Temporal.PlainTime.compare(time1, time2) < 0;\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAoBlB,SAAS,kBACd,OACA,OACS;AACT,SAAO,SAAS,UAAU,QAAQ,OAAO,KAAK,IAAI;AACpD;","names":[]}
@@ -0,0 +1,25 @@
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
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,10 @@
1
+ // src/isPlainTimeAfter.ts
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ function isPlainTimeAfter(time1, time2) {
4
+ return Temporal.PlainTime.compare(time1, time2) > 0;
5
+ }
6
+
7
+ export {
8
+ isPlainTimeAfter
9
+ };
10
+ //# sourceMappingURL=chunk-RBEW6PXR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/isPlainTimeAfter.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\n\n/**\n * Returns true if the first plain time is after the second plain time.\n * Compares wall-clock times without date or timezone considerations.\n *\n * @param time1 - First plain time\n * @param time2 - Second plain time\n * @returns true if time1 is after time2, false otherwise\n *\n * @example\n * ```ts\n * const morning = Temporal.PlainTime.from('09:00');\n * const evening = Temporal.PlainTime.from('17:00');\n *\n * isPlainTimeAfter(evening, morning); // true\n * isPlainTimeAfter(morning, evening); // false\n * isPlainTimeAfter(morning, morning); // false\n * ```\n */\nexport function isPlainTimeAfter(\n time1: Temporal.PlainTime,\n time2: Temporal.PlainTime\n): boolean {\n return Temporal.PlainTime.compare(time1, time2) > 0;\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAoBlB,SAAS,iBACd,OACA,OACS;AACT,SAAO,SAAS,UAAU,QAAQ,OAAO,KAAK,IAAI;AACpD;","names":[]}
@@ -0,0 +1,10 @@
1
+ // src/isPlainTimeEqual.ts
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ function isPlainTimeEqual(time1, time2) {
4
+ return Temporal.PlainTime.compare(time1, time2) === 0;
5
+ }
6
+
7
+ export {
8
+ isPlainTimeEqual
9
+ };
10
+ //# sourceMappingURL=chunk-VZJGCDAG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/isPlainTimeEqual.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\n\n/**\n * Returns true if the two plain times are equal.\n * Compares wall-clock times without date or timezone considerations.\n *\n * @param time1 - First plain time\n * @param time2 - Second plain time\n * @returns true if time1 equals time2, false otherwise\n *\n * @example\n * ```ts\n * const nineAM_a = Temporal.PlainTime.from('09:00');\n * const nineAM_b = Temporal.PlainTime.from('09:00');\n * const fivePM = Temporal.PlainTime.from('17:00');\n *\n * isPlainTimeEqual(nineAM_a, nineAM_b); // true\n * isPlainTimeEqual(nineAM_a, fivePM); // false\n * ```\n */\nexport function isPlainTimeEqual(\n time1: Temporal.PlainTime,\n time2: Temporal.PlainTime\n): boolean {\n return Temporal.PlainTime.compare(time1, time2) === 0;\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAoBlB,SAAS,iBACd,OACA,OACS;AACT,SAAO,SAAS,UAAU,QAAQ,OAAO,KAAK,MAAM;AACtD;","names":[]}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { toZonedTime } from './toZonedTime';
2
+ export { toPlainTime } from './toPlainTime';
2
3
  export type { Timezone, IANATimezone } from './types';
3
4
  export { browserTimezone } from './browserTimezone';
4
5
  export { toUtc } from './toUtc';
@@ -66,4 +67,7 @@ export { intlFormatDistance, type IntlFormatDistanceOptions, } from './intlForma
66
67
  export { isPlainDateBefore } from './isPlainDateBefore';
67
68
  export { isPlainDateAfter } from './isPlainDateAfter';
68
69
  export { isPlainDateEqual } from './isPlainDateEqual';
70
+ export { isPlainTimeBefore } from './isPlainTimeBefore';
71
+ export { isPlainTimeAfter } from './isPlainTimeAfter';
72
+ export { isPlainTimeEqual } from './isPlainTimeEqual';
69
73
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACt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AO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -1,9 +1,21 @@
1
+ import {
2
+ today
3
+ } from "./chunk-KZB6NERH.js";
4
+ import {
5
+ subYears
6
+ } from "./chunk-AHMKY474.js";
7
+ import {
8
+ toDate
9
+ } from "./chunk-TGKWBQ7L.js";
1
10
  import {
2
11
  toIso
3
12
  } from "./chunk-BSV32PSO.js";
4
13
  import {
5
14
  toIso9075
6
15
  } from "./chunk-DFLGGK4F.js";
16
+ import {
17
+ toPlainTime
18
+ } from "./chunk-G45S5B4O.js";
7
19
  import {
8
20
  toUtc
9
21
  } from "./chunk-BW5SFCKS.js";
@@ -11,8 +23,14 @@ import {
11
23
  toZonedTime
12
24
  } from "./chunk-MXQFENCR.js";
13
25
  import {
14
- today
15
- } from "./chunk-KZB6NERH.js";
26
+ subHours
27
+ } from "./chunk-XW5MLXX5.js";
28
+ import {
29
+ subMicroseconds
30
+ } from "./chunk-BQBLSXK2.js";
31
+ import {
32
+ subMilliseconds
33
+ } from "./chunk-HDBH7RTY.js";
16
34
  import {
17
35
  subMinutes
18
36
  } from "./chunk-J6G2I2TU.js";
@@ -29,11 +47,14 @@ import {
29
47
  subWeeks
30
48
  } from "./chunk-U4RNUZXO.js";
31
49
  import {
32
- subYears
33
- } from "./chunk-AHMKY474.js";
50
+ isSameYear
51
+ } from "./chunk-VLZ3HQQA.js";
34
52
  import {
35
- toDate
36
- } from "./chunk-TGKWBQ7L.js";
53
+ now
54
+ } from "./chunk-FSD3DDFC.js";
55
+ import {
56
+ simpleFormat
57
+ } from "./chunk-TFSZ55L7.js";
37
58
  import {
38
59
  startOfDay
39
60
  } from "./chunk-TW5EV3DH.js";
@@ -50,14 +71,14 @@ import {
50
71
  subDays
51
72
  } from "./chunk-YKBP3G7L.js";
52
73
  import {
53
- subHours
54
- } from "./chunk-XW5MLXX5.js";
74
+ isSameHour
75
+ } from "./chunk-EEQ3REET.js";
55
76
  import {
56
- subMicroseconds
57
- } from "./chunk-BQBLSXK2.js";
77
+ isSameMicrosecond
78
+ } from "./chunk-PPB62JYV.js";
58
79
  import {
59
- subMilliseconds
60
- } from "./chunk-HDBH7RTY.js";
80
+ isSameMillisecond
81
+ } from "./chunk-ISHZRFVN.js";
61
82
  import {
62
83
  isSameMinute
63
84
  } from "./chunk-LDO6PRNJ.js";
@@ -73,15 +94,6 @@ import {
73
94
  import {
74
95
  isSameWeek
75
96
  } from "./chunk-JOD4ATPE.js";
76
- import {
77
- isSameYear
78
- } from "./chunk-VLZ3HQQA.js";
79
- import {
80
- now
81
- } from "./chunk-FSD3DDFC.js";
82
- import {
83
- simpleFormat
84
- } from "./chunk-TFSZ55L7.js";
85
97
  import {
86
98
  isPast
87
99
  } from "./chunk-2H4KLXGL.js";
@@ -95,17 +107,17 @@ import {
95
107
  isPlainDateEqual
96
108
  } from "./chunk-O6RIN7K3.js";
97
109
  import {
98
- isSameDay
99
- } from "./chunk-RW3C2677.js";
110
+ isPlainTimeAfter
111
+ } from "./chunk-RBEW6PXR.js";
100
112
  import {
101
- isSameHour
102
- } from "./chunk-EEQ3REET.js";
113
+ isPlainTimeBefore
114
+ } from "./chunk-AJEIDKVJ.js";
103
115
  import {
104
- isSameMicrosecond
105
- } from "./chunk-PPB62JYV.js";
116
+ isPlainTimeEqual
117
+ } from "./chunk-VZJGCDAG.js";
106
118
  import {
107
- isSameMillisecond
108
- } from "./chunk-ISHZRFVN.js";
119
+ isSameDay
120
+ } from "./chunk-RW3C2677.js";
109
121
  import {
110
122
  endOfYear
111
123
  } from "./chunk-XDVUGTUV.js";
@@ -237,6 +249,9 @@ export {
237
249
  isPlainDateAfter,
238
250
  isPlainDateBefore,
239
251
  isPlainDateEqual,
252
+ isPlainTimeAfter,
253
+ isPlainTimeBefore,
254
+ isPlainTimeEqual,
240
255
  isSameDay,
241
256
  isSameHour,
242
257
  isSameMicrosecond,
@@ -266,6 +281,7 @@ export {
266
281
  toDate,
267
282
  toIso,
268
283
  toIso9075,
284
+ toPlainTime,
269
285
  toUtc,
270
286
  toZonedTime,
271
287
  today
@@ -0,0 +1,21 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Returns true if the first plain time is after the second plain time.
4
+ * Compares wall-clock times without date or timezone considerations.
5
+ *
6
+ * @param time1 - First plain time
7
+ * @param time2 - Second plain time
8
+ * @returns true if time1 is after time2, false otherwise
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const morning = Temporal.PlainTime.from('09:00');
13
+ * const evening = Temporal.PlainTime.from('17:00');
14
+ *
15
+ * isPlainTimeAfter(evening, morning); // true
16
+ * isPlainTimeAfter(morning, evening); // false
17
+ * isPlainTimeAfter(morning, morning); // false
18
+ * ```
19
+ */
20
+ export declare function isPlainTimeAfter(time1: Temporal.PlainTime, time2: Temporal.PlainTime): boolean;
21
+ //# sourceMappingURL=isPlainTimeAfter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPlainTimeAfter.d.ts","sourceRoot":"","sources":["../src/isPlainTimeAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,KAAK,EAAE,QAAQ,CAAC,SAAS,GACxB,OAAO,CAET"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ isPlainTimeAfter
3
+ } from "./chunk-RBEW6PXR.js";
4
+ export {
5
+ isPlainTimeAfter
6
+ };
7
+ //# sourceMappingURL=isPlainTimeAfter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isPlainTimeAfter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPlainTimeAfter.test.d.ts","sourceRoot":"","sources":["../src/isPlainTimeAfter.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Returns true if the first plain time is before the second plain time.
4
+ * Compares wall-clock times without date or timezone considerations.
5
+ *
6
+ * @param time1 - First plain time
7
+ * @param time2 - Second plain time
8
+ * @returns true if time1 is before time2, false otherwise
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const morning = Temporal.PlainTime.from('09:00');
13
+ * const evening = Temporal.PlainTime.from('17:00');
14
+ *
15
+ * isPlainTimeBefore(morning, evening); // true
16
+ * isPlainTimeBefore(evening, morning); // false
17
+ * isPlainTimeBefore(morning, morning); // false
18
+ * ```
19
+ */
20
+ export declare function isPlainTimeBefore(time1: Temporal.PlainTime, time2: Temporal.PlainTime): boolean;
21
+ //# sourceMappingURL=isPlainTimeBefore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPlainTimeBefore.d.ts","sourceRoot":"","sources":["../src/isPlainTimeBefore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,KAAK,EAAE,QAAQ,CAAC,SAAS,GACxB,OAAO,CAET"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ isPlainTimeBefore
3
+ } from "./chunk-AJEIDKVJ.js";
4
+ export {
5
+ isPlainTimeBefore
6
+ };
7
+ //# sourceMappingURL=isPlainTimeBefore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isPlainTimeBefore.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPlainTimeBefore.test.d.ts","sourceRoot":"","sources":["../src/isPlainTimeBefore.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Returns true if the two plain times are equal.
4
+ * Compares wall-clock times without date or timezone considerations.
5
+ *
6
+ * @param time1 - First plain time
7
+ * @param time2 - Second plain time
8
+ * @returns true if time1 equals time2, false otherwise
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const nineAM_a = Temporal.PlainTime.from('09:00');
13
+ * const nineAM_b = Temporal.PlainTime.from('09:00');
14
+ * const fivePM = Temporal.PlainTime.from('17:00');
15
+ *
16
+ * isPlainTimeEqual(nineAM_a, nineAM_b); // true
17
+ * isPlainTimeEqual(nineAM_a, fivePM); // false
18
+ * ```
19
+ */
20
+ export declare function isPlainTimeEqual(time1: Temporal.PlainTime, time2: Temporal.PlainTime): boolean;
21
+ //# sourceMappingURL=isPlainTimeEqual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPlainTimeEqual.d.ts","sourceRoot":"","sources":["../src/isPlainTimeEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,KAAK,EAAE,QAAQ,CAAC,SAAS,GACxB,OAAO,CAET"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ isPlainTimeEqual
3
+ } from "./chunk-VZJGCDAG.js";
4
+ export {
5
+ isPlainTimeEqual
6
+ };
7
+ //# sourceMappingURL=isPlainTimeEqual.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isPlainTimeEqual.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPlainTimeEqual.test.d.ts","sourceRoot":"","sources":["../src/isPlainTimeEqual.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ import type { Timezone } from './types';
3
+ /**
4
+ * Extract the wall-clock time from a ZonedDateTime or convert an input to a timezone and extract the time.
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.
8
+ * @returns A Temporal.PlainTime representing the wall-clock time
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { toPlainTime, toZonedTime } from '@gobrand/tiempo';
13
+ *
14
+ * // From ZonedDateTime (no timezone needed)
15
+ * const zdt = toZonedTime("2025-01-20T15:30:00Z", "America/New_York");
16
+ * const time = toPlainTime(zdt); // 10:30
17
+ *
18
+ * // From UTC string with timezone
19
+ * const time2 = toPlainTime("2025-01-20T15:30:00Z", "America/New_York"); // 10:30
20
+ *
21
+ * // From Date with timezone
22
+ * const date = new Date("2025-01-20T15:30:00.000Z");
23
+ * const time3 = toPlainTime(date, "Europe/London"); // 15:30
24
+ *
25
+ * // From Instant with timezone
26
+ * const instant = Temporal.Instant.from("2025-01-20T15:30:00Z");
27
+ * const time4 = toPlainTime(instant, "Asia/Tokyo"); // 00:30
28
+ * ```
29
+ */
30
+ export declare function toPlainTime(input: Temporal.ZonedDateTime): Temporal.PlainTime;
31
+ export declare function toPlainTime(input: string | Date | Temporal.Instant | Temporal.ZonedDateTime, timezone: Timezone): Temporal.PlainTime;
32
+ //# sourceMappingURL=toPlainTime.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ toPlainTime
3
+ } from "./chunk-G45S5B4O.js";
4
+ export {
5
+ toPlainTime
6
+ };
7
+ //# sourceMappingURL=toPlainTime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=toPlainTime.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toPlainTime.test.d.ts","sourceRoot":"","sources":["../src/toPlainTime.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobrand/tiempo",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
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": {