@gobrand/tiempo 2.2.1 → 2.2.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 (101) hide show
  1. package/README.md +156 -10
  2. package/dist/chunk-2H4KLXGL.js +16 -0
  3. package/dist/chunk-2H4KLXGL.js.map +1 -0
  4. package/dist/chunk-6IP245MS.js +17 -0
  5. package/dist/chunk-6IP245MS.js.map +1 -0
  6. package/dist/chunk-BIAPE4MR.js +17 -0
  7. package/dist/chunk-BIAPE4MR.js.map +1 -0
  8. package/dist/chunk-CHW2EN2O.js +17 -0
  9. package/dist/chunk-CHW2EN2O.js.map +1 -0
  10. package/dist/chunk-D7DPB2JR.js +16 -0
  11. package/dist/chunk-D7DPB2JR.js.map +1 -0
  12. package/dist/chunk-OABS374T.js +16 -0
  13. package/dist/chunk-OABS374T.js.map +1 -0
  14. package/dist/chunk-PIDXROVB.js +16 -0
  15. package/dist/chunk-PIDXROVB.js.map +1 -0
  16. package/dist/chunk-PVAOUYXF.js +17 -0
  17. package/dist/chunk-PVAOUYXF.js.map +1 -0
  18. package/dist/chunk-R5XN76EV.js +16 -0
  19. package/dist/chunk-R5XN76EV.js.map +1 -0
  20. package/dist/chunk-RJY62CDU.js +16 -0
  21. package/dist/chunk-RJY62CDU.js.map +1 -0
  22. package/dist/chunk-ZGR4NZTS.js +17 -0
  23. package/dist/chunk-ZGR4NZTS.js.map +1 -0
  24. package/dist/chunk-ZHRMURYP.js +16 -0
  25. package/dist/chunk-ZHRMURYP.js.map +1 -0
  26. package/dist/differenceInDays.d.ts +43 -0
  27. package/dist/differenceInDays.d.ts.map +1 -0
  28. package/dist/differenceInDays.js +8 -0
  29. package/dist/differenceInDays.js.map +1 -0
  30. package/dist/differenceInDays.test.d.ts +2 -0
  31. package/dist/differenceInDays.test.d.ts.map +1 -0
  32. package/dist/differenceInHours.d.ts +37 -0
  33. package/dist/differenceInHours.d.ts.map +1 -0
  34. package/dist/differenceInHours.js +8 -0
  35. package/dist/differenceInHours.js.map +1 -0
  36. package/dist/differenceInHours.test.d.ts +2 -0
  37. package/dist/differenceInHours.test.d.ts.map +1 -0
  38. package/dist/differenceInMicroseconds.d.ts +37 -0
  39. package/dist/differenceInMicroseconds.d.ts.map +1 -0
  40. package/dist/differenceInMicroseconds.js +8 -0
  41. package/dist/differenceInMicroseconds.js.map +1 -0
  42. package/dist/differenceInMicroseconds.test.d.ts +2 -0
  43. package/dist/differenceInMicroseconds.test.d.ts.map +1 -0
  44. package/dist/differenceInMilliseconds.d.ts +37 -0
  45. package/dist/differenceInMilliseconds.d.ts.map +1 -0
  46. package/dist/differenceInMilliseconds.js +8 -0
  47. package/dist/differenceInMilliseconds.js.map +1 -0
  48. package/dist/differenceInMilliseconds.test.d.ts +2 -0
  49. package/dist/differenceInMilliseconds.test.d.ts.map +1 -0
  50. package/dist/differenceInMinutes.d.ts +37 -0
  51. package/dist/differenceInMinutes.d.ts.map +1 -0
  52. package/dist/differenceInMinutes.js +8 -0
  53. package/dist/differenceInMinutes.js.map +1 -0
  54. package/dist/differenceInMinutes.test.d.ts +2 -0
  55. package/dist/differenceInMinutes.test.d.ts.map +1 -0
  56. package/dist/differenceInMonths.d.ts +43 -0
  57. package/dist/differenceInMonths.d.ts.map +1 -0
  58. package/dist/differenceInMonths.js +8 -0
  59. package/dist/differenceInMonths.js.map +1 -0
  60. package/dist/differenceInMonths.test.d.ts +2 -0
  61. package/dist/differenceInMonths.test.d.ts.map +1 -0
  62. package/dist/differenceInNanoseconds.d.ts +37 -0
  63. package/dist/differenceInNanoseconds.d.ts.map +1 -0
  64. package/dist/differenceInNanoseconds.js +8 -0
  65. package/dist/differenceInNanoseconds.js.map +1 -0
  66. package/dist/differenceInNanoseconds.test.d.ts +2 -0
  67. package/dist/differenceInNanoseconds.test.d.ts.map +1 -0
  68. package/dist/differenceInSeconds.d.ts +37 -0
  69. package/dist/differenceInSeconds.d.ts.map +1 -0
  70. package/dist/differenceInSeconds.js +8 -0
  71. package/dist/differenceInSeconds.js.map +1 -0
  72. package/dist/differenceInSeconds.test.d.ts +2 -0
  73. package/dist/differenceInSeconds.test.d.ts.map +1 -0
  74. package/dist/differenceInWeeks.d.ts +43 -0
  75. package/dist/differenceInWeeks.d.ts.map +1 -0
  76. package/dist/differenceInWeeks.js +8 -0
  77. package/dist/differenceInWeeks.js.map +1 -0
  78. package/dist/differenceInWeeks.test.d.ts +2 -0
  79. package/dist/differenceInWeeks.test.d.ts.map +1 -0
  80. package/dist/differenceInYears.d.ts +43 -0
  81. package/dist/differenceInYears.d.ts.map +1 -0
  82. package/dist/differenceInYears.js +8 -0
  83. package/dist/differenceInYears.js.map +1 -0
  84. package/dist/differenceInYears.test.d.ts +2 -0
  85. package/dist/differenceInYears.test.d.ts.map +1 -0
  86. package/dist/index.d.ts +12 -0
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +59 -11
  89. package/dist/isFuture.d.ts +35 -0
  90. package/dist/isFuture.d.ts.map +1 -0
  91. package/dist/isFuture.js +8 -0
  92. package/dist/isFuture.js.map +1 -0
  93. package/dist/isFuture.test.d.ts +2 -0
  94. package/dist/isFuture.test.d.ts.map +1 -0
  95. package/dist/isPast.d.ts +35 -0
  96. package/dist/isPast.d.ts.map +1 -0
  97. package/dist/isPast.js +8 -0
  98. package/dist/isPast.js.map +1 -0
  99. package/dist/isPast.test.d.ts +2 -0
  100. package/dist/isPast.test.d.ts.map +1 -0
  101. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,3 +1,12 @@
1
+ import {
2
+ startOfWeek
3
+ } from "./chunk-2WMXB7QL.js";
4
+ import {
5
+ startOfYear
6
+ } from "./chunk-YR2UCUIT.js";
7
+ import {
8
+ toUtc
9
+ } from "./chunk-GPAFAHKJ.js";
1
10
  import {
2
11
  toUtcString
3
12
  } from "./chunk-DMKGJY4N.js";
@@ -7,6 +16,18 @@ import {
7
16
  import {
8
17
  today
9
18
  } from "./chunk-67QHALIG.js";
19
+ import {
20
+ isAfter
21
+ } from "./chunk-BBNNR2QH.js";
22
+ import {
23
+ isBefore
24
+ } from "./chunk-IPJUERCK.js";
25
+ import {
26
+ isFuture
27
+ } from "./chunk-R5XN76EV.js";
28
+ import {
29
+ isPast
30
+ } from "./chunk-2H4KLXGL.js";
10
31
  import {
11
32
  isSameDay
12
33
  } from "./chunk-RW3C2677.js";
@@ -20,14 +41,11 @@ import {
20
41
  startOfMonth
21
42
  } from "./chunk-TU2UNOOW.js";
22
43
  import {
23
- startOfWeek
24
- } from "./chunk-2WMXB7QL.js";
44
+ differenceInWeeks
45
+ } from "./chunk-PVAOUYXF.js";
25
46
  import {
26
- startOfYear
27
- } from "./chunk-YR2UCUIT.js";
28
- import {
29
- toUtc
30
- } from "./chunk-GPAFAHKJ.js";
47
+ differenceInYears
48
+ } from "./chunk-CHW2EN2O.js";
31
49
  import {
32
50
  endOfDay
33
51
  } from "./chunk-CUMB4776.js";
@@ -45,13 +63,41 @@ import {
45
63
  format
46
64
  } from "./chunk-2G5RJGPR.js";
47
65
  import {
48
- isAfter
49
- } from "./chunk-BBNNR2QH.js";
66
+ differenceInDays
67
+ } from "./chunk-6IP245MS.js";
50
68
  import {
51
- isBefore
52
- } from "./chunk-IPJUERCK.js";
69
+ differenceInHours
70
+ } from "./chunk-PIDXROVB.js";
71
+ import {
72
+ differenceInMicroseconds
73
+ } from "./chunk-ZGR4NZTS.js";
74
+ import {
75
+ differenceInMilliseconds
76
+ } from "./chunk-D7DPB2JR.js";
77
+ import {
78
+ differenceInMinutes
79
+ } from "./chunk-RJY62CDU.js";
80
+ import {
81
+ differenceInMonths
82
+ } from "./chunk-BIAPE4MR.js";
83
+ import {
84
+ differenceInNanoseconds
85
+ } from "./chunk-OABS374T.js";
86
+ import {
87
+ differenceInSeconds
88
+ } from "./chunk-ZHRMURYP.js";
53
89
  import "./chunk-MJSZNWCV.js";
54
90
  export {
91
+ differenceInDays,
92
+ differenceInHours,
93
+ differenceInMicroseconds,
94
+ differenceInMilliseconds,
95
+ differenceInMinutes,
96
+ differenceInMonths,
97
+ differenceInNanoseconds,
98
+ differenceInSeconds,
99
+ differenceInWeeks,
100
+ differenceInYears,
55
101
  endOfDay,
56
102
  endOfMonth,
57
103
  endOfWeek,
@@ -59,6 +105,8 @@ export {
59
105
  format,
60
106
  isAfter,
61
107
  isBefore,
108
+ isFuture,
109
+ isPast,
62
110
  isSameDay,
63
111
  now,
64
112
  startOfDay,
@@ -0,0 +1,35 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Returns true if the given datetime is in the future.
4
+ * Compares by the underlying instant (epoch time) against the current time.
5
+ *
6
+ * @param date - Datetime to check (Instant or ZonedDateTime)
7
+ * @returns true if date is after the current instant, false otherwise
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const tomorrow = Temporal.Now.zonedDateTimeISO().add({ days: 1 });
12
+ * const yesterday = Temporal.Now.zonedDateTimeISO().subtract({ days: 1 });
13
+ *
14
+ * isFuture(tomorrow); // true
15
+ * isFuture(yesterday); // false
16
+ * ```
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Works with Instant too
21
+ * const futureInstant = Temporal.Now.instant().add({ hours: 1 });
22
+ *
23
+ * isFuture(futureInstant); // true
24
+ * ```
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * // Works with any timezone
29
+ * const futureInTokyo = Temporal.ZonedDateTime.from('2100-01-01T00:00:00+09:00[Asia/Tokyo]');
30
+ *
31
+ * isFuture(futureInTokyo); // true
32
+ * ```
33
+ */
34
+ export declare function isFuture(date: Temporal.Instant | Temporal.ZonedDateTime): boolean;
35
+ //# sourceMappingURL=isFuture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isFuture.d.ts","sourceRoot":"","sources":["../src/isFuture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC9C,OAAO,CAKT"}
@@ -0,0 +1,8 @@
1
+ import {
2
+ isFuture
3
+ } from "./chunk-R5XN76EV.js";
4
+ import "./chunk-MJSZNWCV.js";
5
+ export {
6
+ isFuture
7
+ };
8
+ //# sourceMappingURL=isFuture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isFuture.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isFuture.test.d.ts","sourceRoot":"","sources":["../src/isFuture.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ /**
3
+ * Returns true if the given datetime is in the past.
4
+ * Compares by the underlying instant (epoch time) against the current time.
5
+ *
6
+ * @param date - Datetime to check (Instant or ZonedDateTime)
7
+ * @returns true if date is before the current instant, false otherwise
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const yesterday = Temporal.Now.zonedDateTimeISO().subtract({ days: 1 });
12
+ * const tomorrow = Temporal.Now.zonedDateTimeISO().add({ days: 1 });
13
+ *
14
+ * isPast(yesterday); // true
15
+ * isPast(tomorrow); // false
16
+ * ```
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Works with Instant too
21
+ * const pastInstant = Temporal.Now.instant().subtract({ hours: 1 });
22
+ *
23
+ * isPast(pastInstant); // true
24
+ * ```
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * // Works with any timezone
29
+ * const pastInTokyo = Temporal.ZonedDateTime.from('1970-01-01T00:00:00+09:00[Asia/Tokyo]');
30
+ *
31
+ * isPast(pastInTokyo); // true
32
+ * ```
33
+ */
34
+ export declare function isPast(date: Temporal.Instant | Temporal.ZonedDateTime): boolean;
35
+ //# sourceMappingURL=isPast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPast.d.ts","sourceRoot":"","sources":["../src/isPast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC9C,OAAO,CAKT"}
package/dist/isPast.js ADDED
@@ -0,0 +1,8 @@
1
+ import {
2
+ isPast
3
+ } from "./chunk-2H4KLXGL.js";
4
+ import "./chunk-MJSZNWCV.js";
5
+ export {
6
+ isPast
7
+ };
8
+ //# sourceMappingURL=isPast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isPast.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPast.test.d.ts","sourceRoot":"","sources":["../src/isPast.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobrand/tiempo",
3
- "version": "2.2.1",
3
+ "version": "2.2.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": {