@gobrand/tiempo 2.1.1 → 2.1.3
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.
- package/README.md +135 -11
- package/dist/{chunk-5FRUAUH2.js → chunk-2G5RJGPR.js} +9 -5
- package/dist/chunk-2G5RJGPR.js.map +1 -0
- package/dist/chunk-2WMXB7QL.js +17 -0
- package/dist/chunk-2WMXB7QL.js.map +1 -0
- package/dist/chunk-AVGNRINZ.js +9 -0
- package/dist/chunk-AVGNRINZ.js.map +1 -0
- package/dist/chunk-BBNNR2QH.js +16 -0
- package/dist/chunk-BBNNR2QH.js.map +1 -0
- package/dist/chunk-CUMB4776.js +18 -0
- package/dist/chunk-CUMB4776.js.map +1 -0
- package/dist/chunk-GM6RNAYE.js +19 -0
- package/dist/chunk-GM6RNAYE.js.map +1 -0
- package/dist/chunk-IPJUERCK.js +16 -0
- package/dist/chunk-IPJUERCK.js.map +1 -0
- package/dist/chunk-MJSZNWCV.js +10 -0
- package/dist/chunk-MJSZNWCV.js.map +1 -0
- package/dist/chunk-RW3C2677.js +16 -0
- package/dist/chunk-RW3C2677.js.map +1 -0
- package/dist/chunk-TU2UNOOW.js +15 -0
- package/dist/chunk-TU2UNOOW.js.map +1 -0
- package/dist/chunk-TW5EV3DH.js +14 -0
- package/dist/chunk-TW5EV3DH.js.map +1 -0
- package/dist/chunk-XDVUGTUV.js +20 -0
- package/dist/chunk-XDVUGTUV.js.map +1 -0
- package/dist/chunk-XVJJR7H6.js +20 -0
- package/dist/chunk-XVJJR7H6.js.map +1 -0
- package/dist/chunk-YR2UCUIT.js +15 -0
- package/dist/chunk-YR2UCUIT.js.map +1 -0
- package/dist/endOfDay.d.ts +34 -0
- package/dist/endOfDay.d.ts.map +1 -0
- package/dist/endOfDay.js +9 -0
- package/dist/endOfDay.js.map +1 -0
- package/dist/endOfDay.test.d.ts +2 -0
- package/dist/endOfDay.test.d.ts.map +1 -0
- package/dist/endOfMonth.d.ts +34 -0
- package/dist/endOfMonth.d.ts.map +1 -0
- package/dist/endOfMonth.js +9 -0
- package/dist/endOfMonth.js.map +1 -0
- package/dist/endOfMonth.test.d.ts +2 -0
- package/dist/endOfMonth.test.d.ts.map +1 -0
- package/dist/endOfWeek.d.ts +35 -0
- package/dist/endOfWeek.d.ts.map +1 -0
- package/dist/endOfWeek.js +9 -0
- package/dist/endOfWeek.js.map +1 -0
- package/dist/endOfWeek.test.d.ts +2 -0
- package/dist/endOfWeek.test.d.ts.map +1 -0
- package/dist/endOfYear.d.ts +34 -0
- package/dist/endOfYear.d.ts.map +1 -0
- package/dist/endOfYear.js +9 -0
- package/dist/endOfYear.js.map +1 -0
- package/dist/endOfYear.test.d.ts +2 -0
- package/dist/endOfYear.test.d.ts.map +1 -0
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +2 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -4
- package/dist/isAfter.d.ts +40 -0
- package/dist/isAfter.d.ts.map +1 -0
- package/dist/isAfter.js +8 -0
- package/dist/isAfter.js.map +1 -0
- package/dist/isAfter.test.d.ts +2 -0
- package/dist/isAfter.test.d.ts.map +1 -0
- package/dist/isBefore.d.ts +40 -0
- package/dist/isBefore.d.ts.map +1 -0
- package/dist/isBefore.js +8 -0
- package/dist/isBefore.js.map +1 -0
- package/dist/isBefore.test.d.ts +2 -0
- package/dist/isBefore.test.d.ts.map +1 -0
- package/dist/isSameDay.d.ts +58 -0
- package/dist/isSameDay.d.ts.map +1 -0
- package/dist/isSameDay.js +8 -0
- package/dist/isSameDay.js.map +1 -0
- package/dist/isSameDay.test.d.ts +2 -0
- package/dist/isSameDay.test.d.ts.map +1 -0
- package/dist/shared/endOfDay.d.ts +7 -0
- package/dist/shared/endOfDay.d.ts.map +1 -0
- package/dist/shared/endOfDay.js +7 -0
- package/dist/shared/endOfDay.js.map +1 -0
- package/dist/shared/normalizeTemporalInput.d.ts +8 -0
- package/dist/shared/normalizeTemporalInput.d.ts.map +1 -0
- package/dist/shared/normalizeTemporalInput.js +7 -0
- package/dist/shared/normalizeTemporalInput.js.map +1 -0
- package/dist/startOfDay.d.ts +34 -0
- package/dist/startOfDay.d.ts.map +1 -0
- package/dist/startOfDay.js +8 -0
- package/dist/startOfDay.js.map +1 -0
- package/dist/startOfDay.test.d.ts +2 -0
- package/dist/startOfDay.test.d.ts.map +1 -0
- package/dist/startOfMonth.d.ts +34 -0
- package/dist/startOfMonth.d.ts.map +1 -0
- package/dist/startOfMonth.js +8 -0
- package/dist/startOfMonth.js.map +1 -0
- package/dist/startOfMonth.test.d.ts +2 -0
- package/dist/startOfMonth.test.d.ts.map +1 -0
- package/dist/startOfWeek.d.ts +35 -0
- package/dist/startOfWeek.d.ts.map +1 -0
- package/dist/startOfWeek.js +8 -0
- package/dist/startOfWeek.js.map +1 -0
- package/dist/startOfWeek.test.d.ts +2 -0
- package/dist/startOfWeek.test.d.ts.map +1 -0
- package/dist/startOfYear.d.ts +34 -0
- package/dist/startOfYear.d.ts.map +1 -0
- package/dist/startOfYear.js +8 -0
- package/dist/startOfYear.js.map +1 -0
- package/dist/startOfYear.test.d.ts +2 -0
- package/dist/startOfYear.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-5FRUAUH2.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endOfDay.test.d.ts","sourceRoot":"","sources":["../src/endOfDay.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a ZonedDateTime representing the last moment of the month (last day at 23:59:59.999999999).
|
|
4
|
+
*
|
|
5
|
+
* @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime
|
|
6
|
+
* @returns ZonedDateTime at the last day of the month at 23:59:59.999999999
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // From Instant (always UTC)
|
|
11
|
+
* const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');
|
|
12
|
+
* const end = endOfMonth(instant);
|
|
13
|
+
* // 2025-01-31T23:59:59.999999999Z[UTC]
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // From ZonedDateTime (uses its timezone)
|
|
19
|
+
* const zoned = Temporal.ZonedDateTime.from('2025-02-15T15:30:00-05:00[America/New_York]');
|
|
20
|
+
* const end = endOfMonth(zoned);
|
|
21
|
+
* // 2025-02-28T23:59:59.999999999-05:00[America/New_York]
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Need a different timezone? Convert first
|
|
27
|
+
* const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');
|
|
28
|
+
* const nyTime = instant.toZonedDateTimeISO('America/New_York');
|
|
29
|
+
* const end = endOfMonth(nyTime);
|
|
30
|
+
* // 2025-01-31T23:59:59.999999999-05:00[America/New_York]
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function endOfMonth(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
|
|
34
|
+
//# sourceMappingURL=endOfMonth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endOfMonth.d.ts","sourceRoot":"","sources":["../src/endOfMonth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAUxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endOfMonth.test.d.ts","sourceRoot":"","sources":["../src/endOfMonth.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a ZonedDateTime representing the last moment of the week (Sunday at 23:59:59.999999999).
|
|
4
|
+
* Uses ISO 8601 week definition: weeks end on Sunday.
|
|
5
|
+
*
|
|
6
|
+
* @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime
|
|
7
|
+
* @returns ZonedDateTime at Sunday 23:59:59.999999999
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* // From Instant (always UTC)
|
|
12
|
+
* const instant = Temporal.Instant.from('2025-01-20T12:00:00Z'); // Monday
|
|
13
|
+
* const end = endOfWeek(instant);
|
|
14
|
+
* // 2025-01-26T23:59:59.999999999Z[UTC] (next Sunday)
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* // From ZonedDateTime (uses its timezone)
|
|
20
|
+
* const zoned = Temporal.ZonedDateTime.from('2025-01-22T15:30:00-05:00[America/New_York]'); // Wednesday
|
|
21
|
+
* const end = endOfWeek(zoned);
|
|
22
|
+
* // 2025-01-26T23:59:59.999999999-05:00[America/New_York] (next Sunday)
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* // Need a different timezone? Convert first
|
|
28
|
+
* const instant = Temporal.Instant.from('2025-01-22T12:00:00Z');
|
|
29
|
+
* const nyTime = instant.toZonedDateTimeISO('America/New_York');
|
|
30
|
+
* const end = endOfWeek(nyTime);
|
|
31
|
+
* // 2025-01-26T23:59:59.999999999-05:00[America/New_York]
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function endOfWeek(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
|
|
35
|
+
//# sourceMappingURL=endOfWeek.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endOfWeek.d.ts","sourceRoot":"","sources":["../src/endOfWeek.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAaxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endOfWeek.test.d.ts","sourceRoot":"","sources":["../src/endOfWeek.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a ZonedDateTime representing the last moment of the year (last day at 23:59:59.999999999).
|
|
4
|
+
*
|
|
5
|
+
* @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime
|
|
6
|
+
* @returns ZonedDateTime at the last day of the year at 23:59:59.999999999
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // From Instant (always UTC)
|
|
11
|
+
* const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');
|
|
12
|
+
* const end = endOfYear(instant);
|
|
13
|
+
* // 2025-12-31T23:59:59.999999999Z[UTC]
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // From ZonedDateTime (uses its timezone)
|
|
19
|
+
* const zoned = Temporal.ZonedDateTime.from('2025-06-15T15:30:00-05:00[America/New_York]');
|
|
20
|
+
* const end = endOfYear(zoned);
|
|
21
|
+
* // 2025-12-31T23:59:59.999999999-05:00[America/New_York]
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Need a different timezone? Convert first
|
|
27
|
+
* const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');
|
|
28
|
+
* const nyTime = instant.toZonedDateTimeISO('America/New_York');
|
|
29
|
+
* const end = endOfYear(nyTime);
|
|
30
|
+
* // 2025-12-31T23:59:59.999999999-05:00[America/New_York]
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function endOfYear(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
|
|
34
|
+
//# sourceMappingURL=endOfYear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endOfYear.d.ts","sourceRoot":"","sources":["../src/endOfYear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAWxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endOfYear.test.d.ts","sourceRoot":"","sources":["../src/endOfYear.test.ts"],"names":[],"mappings":""}
|
package/dist/format.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CA+DR"}
|
package/dist/format.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,15 @@ export { toZonedTime } from './toZonedTime';
|
|
|
2
2
|
export { toUtc } from './toUtc';
|
|
3
3
|
export { toUtcString } from './toUtcString';
|
|
4
4
|
export { format, type FormatOptions } from './format';
|
|
5
|
+
export { startOfDay } from './startOfDay';
|
|
6
|
+
export { endOfDay } from './endOfDay';
|
|
7
|
+
export { startOfWeek } from './startOfWeek';
|
|
8
|
+
export { endOfWeek } from './endOfWeek';
|
|
9
|
+
export { startOfMonth } from './startOfMonth';
|
|
10
|
+
export { endOfMonth } from './endOfMonth';
|
|
11
|
+
export { startOfYear } from './startOfYear';
|
|
12
|
+
export { endOfYear } from './endOfYear';
|
|
13
|
+
export { isBefore } from './isBefore';
|
|
14
|
+
export { isAfter } from './isAfter';
|
|
15
|
+
export { isSameDay } from './isSameDay';
|
|
5
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,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,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,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,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
toZonedTime
|
|
3
|
+
} from "./chunk-KD5GEHUA.js";
|
|
4
|
+
import {
|
|
5
|
+
isSameDay
|
|
6
|
+
} from "./chunk-RW3C2677.js";
|
|
7
|
+
import {
|
|
8
|
+
startOfDay
|
|
9
|
+
} from "./chunk-TW5EV3DH.js";
|
|
10
|
+
import {
|
|
11
|
+
startOfMonth
|
|
12
|
+
} from "./chunk-TU2UNOOW.js";
|
|
13
|
+
import {
|
|
14
|
+
startOfWeek
|
|
15
|
+
} from "./chunk-2WMXB7QL.js";
|
|
16
|
+
import {
|
|
17
|
+
startOfYear
|
|
18
|
+
} from "./chunk-YR2UCUIT.js";
|
|
4
19
|
import {
|
|
5
20
|
toUtc
|
|
6
21
|
} from "./chunk-GPAFAHKJ.js";
|
|
@@ -8,10 +23,41 @@ import {
|
|
|
8
23
|
toUtcString
|
|
9
24
|
} from "./chunk-DMKGJY4N.js";
|
|
10
25
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
26
|
+
endOfDay
|
|
27
|
+
} from "./chunk-CUMB4776.js";
|
|
28
|
+
import {
|
|
29
|
+
endOfMonth
|
|
30
|
+
} from "./chunk-GM6RNAYE.js";
|
|
31
|
+
import {
|
|
32
|
+
endOfWeek
|
|
33
|
+
} from "./chunk-XVJJR7H6.js";
|
|
34
|
+
import {
|
|
35
|
+
endOfYear
|
|
36
|
+
} from "./chunk-XDVUGTUV.js";
|
|
37
|
+
import "./chunk-AVGNRINZ.js";
|
|
38
|
+
import {
|
|
39
|
+
format
|
|
40
|
+
} from "./chunk-2G5RJGPR.js";
|
|
41
|
+
import {
|
|
42
|
+
isAfter
|
|
43
|
+
} from "./chunk-BBNNR2QH.js";
|
|
44
|
+
import {
|
|
45
|
+
isBefore
|
|
46
|
+
} from "./chunk-IPJUERCK.js";
|
|
47
|
+
import "./chunk-MJSZNWCV.js";
|
|
13
48
|
export {
|
|
49
|
+
endOfDay,
|
|
50
|
+
endOfMonth,
|
|
51
|
+
endOfWeek,
|
|
52
|
+
endOfYear,
|
|
14
53
|
format,
|
|
54
|
+
isAfter,
|
|
55
|
+
isBefore,
|
|
56
|
+
isSameDay,
|
|
57
|
+
startOfDay,
|
|
58
|
+
startOfMonth,
|
|
59
|
+
startOfWeek,
|
|
60
|
+
startOfYear,
|
|
15
61
|
toUtc,
|
|
16
62
|
toUtcString,
|
|
17
63
|
toZonedTime
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if the first datetime is after the second datetime.
|
|
4
|
+
* Compares by the underlying instant (epoch time), not by calendar date/time.
|
|
5
|
+
*
|
|
6
|
+
* @param date1 - First datetime (Instant or ZonedDateTime)
|
|
7
|
+
* @param date2 - Second datetime (Instant or ZonedDateTime)
|
|
8
|
+
* @returns true if date1 is after date2, false otherwise
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');
|
|
13
|
+
* const later = Temporal.ZonedDateTime.from('2025-01-20T16:00:00-05:00[America/New_York]');
|
|
14
|
+
*
|
|
15
|
+
* isAfter(later, earlier); // true
|
|
16
|
+
* isAfter(earlier, later); // false
|
|
17
|
+
* isAfter(earlier, earlier); // false
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* // Works with Instant too
|
|
23
|
+
* const instant1 = Temporal.Instant.from('2025-01-20T15:00:00Z');
|
|
24
|
+
* const instant2 = Temporal.Instant.from('2025-01-20T16:00:00Z');
|
|
25
|
+
*
|
|
26
|
+
* isAfter(instant2, instant1); // true
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // Different timezones - compares by instant
|
|
32
|
+
* const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');
|
|
33
|
+
* const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');
|
|
34
|
+
*
|
|
35
|
+
* isAfter(tokyo, ny); // false
|
|
36
|
+
* // NY 10:00 is 15:00 UTC, Tokyo 00:00 is 15:00 UTC the previous day (same instant)
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function isAfter(date1: Temporal.Instant | Temporal.ZonedDateTime, date2: Temporal.Instant | Temporal.ZonedDateTime): boolean;
|
|
40
|
+
//# sourceMappingURL=isAfter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isAfter.d.ts","sourceRoot":"","sources":["../src/isAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,OAAO,CAKT"}
|
package/dist/isAfter.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isAfter.test.d.ts","sourceRoot":"","sources":["../src/isAfter.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if the first datetime is before the second datetime.
|
|
4
|
+
* Compares by the underlying instant (epoch time), not by calendar date/time.
|
|
5
|
+
*
|
|
6
|
+
* @param date1 - First datetime (Instant or ZonedDateTime)
|
|
7
|
+
* @param date2 - Second datetime (Instant or ZonedDateTime)
|
|
8
|
+
* @returns true if date1 is before date2, false otherwise
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');
|
|
13
|
+
* const later = Temporal.ZonedDateTime.from('2025-01-20T16:00:00-05:00[America/New_York]');
|
|
14
|
+
*
|
|
15
|
+
* isBefore(earlier, later); // true
|
|
16
|
+
* isBefore(later, earlier); // false
|
|
17
|
+
* isBefore(earlier, earlier); // false
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* // Works with Instant too
|
|
23
|
+
* const instant1 = Temporal.Instant.from('2025-01-20T15:00:00Z');
|
|
24
|
+
* const instant2 = Temporal.Instant.from('2025-01-20T16:00:00Z');
|
|
25
|
+
*
|
|
26
|
+
* isBefore(instant1, instant2); // true
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // Different timezones - compares by instant
|
|
32
|
+
* const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');
|
|
33
|
+
* const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');
|
|
34
|
+
*
|
|
35
|
+
* isBefore(ny, tokyo); // true
|
|
36
|
+
* // NY 10:00 is 15:00 UTC, Tokyo 00:00 is 15:00 UTC the previous day
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function isBefore(date1: Temporal.Instant | Temporal.ZonedDateTime, date2: Temporal.Instant | Temporal.ZonedDateTime): boolean;
|
|
40
|
+
//# sourceMappingURL=isBefore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isBefore.d.ts","sourceRoot":"","sources":["../src/isBefore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,OAAO,CAKT"}
|
package/dist/isBefore.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isBefore.test.d.ts","sourceRoot":"","sources":["../src/isBefore.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if both datetimes fall on the same calendar day.
|
|
4
|
+
* Compares the year, month, and day fields directly.
|
|
5
|
+
*
|
|
6
|
+
* Instant inputs are converted to UTC. For ZonedDateTime inputs, their
|
|
7
|
+
* timezone is preserved. Convert to a common timezone before calling if
|
|
8
|
+
* you need to compare from a specific perspective.
|
|
9
|
+
*
|
|
10
|
+
* @param date1 - First datetime (Instant or ZonedDateTime)
|
|
11
|
+
* @param date2 - Second datetime (Instant or ZonedDateTime)
|
|
12
|
+
* @returns true if both dates are on the same calendar day, false otherwise
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // Same timezone, same day
|
|
17
|
+
* const morning = Temporal.ZonedDateTime.from('2025-01-20T08:00:00Z[UTC]');
|
|
18
|
+
* const evening = Temporal.ZonedDateTime.from('2025-01-20T23:00:00Z[UTC]');
|
|
19
|
+
*
|
|
20
|
+
* isSameDay(morning, evening); // true
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* // Same timezone, different days
|
|
26
|
+
* const today = Temporal.ZonedDateTime.from('2025-01-20T23:59:59Z[UTC]');
|
|
27
|
+
* const tomorrow = Temporal.ZonedDateTime.from('2025-01-21T00:00:00Z[UTC]');
|
|
28
|
+
*
|
|
29
|
+
* isSameDay(today, tomorrow); // false
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* // Different timezones - compares their local calendar days
|
|
35
|
+
* const ny = Temporal.ZonedDateTime.from('2025-01-20T23:00:00-05:00[America/New_York]');
|
|
36
|
+
* const tokyo = Temporal.ZonedDateTime.from('2025-01-21T13:00:00+09:00[Asia/Tokyo]');
|
|
37
|
+
*
|
|
38
|
+
* // Same instant, different calendar days from each person's perspective
|
|
39
|
+
* isSameDay(ny, tokyo); // false (Jan 20 in NY, Jan 21 in Tokyo)
|
|
40
|
+
*
|
|
41
|
+
* // Convert to UTC to compare in UTC timezone
|
|
42
|
+
* isSameDay(ny.withTimeZone('UTC'), tokyo.withTimeZone('UTC')); // true (both Jan 21 in UTC)
|
|
43
|
+
*
|
|
44
|
+
* // Convert to NY timezone to compare from NY perspective
|
|
45
|
+
* isSameDay(ny, tokyo.withTimeZone('America/New_York')); // true (both Jan 20 in NY)
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* // Instant inputs are converted to UTC
|
|
51
|
+
* const instant1 = Temporal.Instant.from('2025-01-20T10:00:00Z');
|
|
52
|
+
* const instant2 = Temporal.Instant.from('2025-01-20T23:00:00Z');
|
|
53
|
+
*
|
|
54
|
+
* isSameDay(instant1, instant2); // true (both Jan 20 in UTC)
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function isSameDay(date1: Temporal.Instant | Temporal.ZonedDateTime, date2: Temporal.Instant | Temporal.ZonedDateTime): boolean;
|
|
58
|
+
//# sourceMappingURL=isSameDay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSameDay.d.ts","sourceRoot":"","sources":["../src/isSameDay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChD,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,OAAO,CAST"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSameDay.test.d.ts","sourceRoot":"","sources":["../src/isSameDay.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Internal helper: Returns the last nanosecond of a given ZonedDateTime's day.
|
|
4
|
+
* Used by endOfDay() and endOfWeek() to ensure consistent DST-safe behavior.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getEndOfDay(zonedDateTime: Temporal.ZonedDateTime): Temporal.ZonedDateTime;
|
|
7
|
+
//# sourceMappingURL=endOfDay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endOfDay.d.ts","sourceRoot":"","sources":["../../src/shared/endOfDay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,aAAa,EAAE,QAAQ,CAAC,aAAa,GACpC,QAAQ,CAAC,aAAa,CAKxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Normalizes input to ZonedDateTime. Converts Instant to UTC, or returns existing ZonedDateTime.
|
|
5
|
+
* This is an internal helper - do not use directly.
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalizeTemporalInput(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
|
|
8
|
+
//# sourceMappingURL=normalizeTemporalInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeTemporalInput.d.ts","sourceRoot":"","sources":["../../src/shared/normalizeTemporalInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAIxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a ZonedDateTime representing the first moment of the day (midnight).
|
|
4
|
+
*
|
|
5
|
+
* @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime
|
|
6
|
+
* @returns ZonedDateTime at 00:00:00.000000000
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // From Instant (always UTC)
|
|
11
|
+
* const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
12
|
+
* const start = startOfDay(instant);
|
|
13
|
+
* // 2025-01-20T00:00:00Z[UTC]
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // From ZonedDateTime (uses its timezone)
|
|
19
|
+
* const zoned = Temporal.ZonedDateTime.from('2025-01-20T15:30:00-05:00[America/New_York]');
|
|
20
|
+
* const start = startOfDay(zoned);
|
|
21
|
+
* // 2025-01-20T00:00:00-05:00[America/New_York]
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Need a different timezone? Convert first
|
|
27
|
+
* const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
28
|
+
* const nyTime = instant.toZonedDateTimeISO('America/New_York');
|
|
29
|
+
* const start = startOfDay(nyTime);
|
|
30
|
+
* // 2025-01-20T00:00:00-05:00[America/New_York]
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function startOfDay(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
|
|
34
|
+
//# sourceMappingURL=startOfDay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startOfDay.d.ts","sourceRoot":"","sources":["../src/startOfDay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAIxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startOfDay.test.d.ts","sourceRoot":"","sources":["../src/startOfDay.test.ts"],"names":[],"mappings":""}
|