@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.
- package/README.md +156 -10
- package/dist/chunk-2H4KLXGL.js +16 -0
- package/dist/chunk-2H4KLXGL.js.map +1 -0
- package/dist/chunk-6IP245MS.js +17 -0
- package/dist/chunk-6IP245MS.js.map +1 -0
- package/dist/chunk-BIAPE4MR.js +17 -0
- package/dist/chunk-BIAPE4MR.js.map +1 -0
- package/dist/chunk-CHW2EN2O.js +17 -0
- package/dist/chunk-CHW2EN2O.js.map +1 -0
- package/dist/chunk-D7DPB2JR.js +16 -0
- package/dist/chunk-D7DPB2JR.js.map +1 -0
- package/dist/chunk-OABS374T.js +16 -0
- package/dist/chunk-OABS374T.js.map +1 -0
- package/dist/chunk-PIDXROVB.js +16 -0
- package/dist/chunk-PIDXROVB.js.map +1 -0
- package/dist/chunk-PVAOUYXF.js +17 -0
- package/dist/chunk-PVAOUYXF.js.map +1 -0
- package/dist/chunk-R5XN76EV.js +16 -0
- package/dist/chunk-R5XN76EV.js.map +1 -0
- package/dist/chunk-RJY62CDU.js +16 -0
- package/dist/chunk-RJY62CDU.js.map +1 -0
- package/dist/chunk-ZGR4NZTS.js +17 -0
- package/dist/chunk-ZGR4NZTS.js.map +1 -0
- package/dist/chunk-ZHRMURYP.js +16 -0
- package/dist/chunk-ZHRMURYP.js.map +1 -0
- package/dist/differenceInDays.d.ts +43 -0
- package/dist/differenceInDays.d.ts.map +1 -0
- package/dist/differenceInDays.js +8 -0
- package/dist/differenceInDays.js.map +1 -0
- package/dist/differenceInDays.test.d.ts +2 -0
- package/dist/differenceInDays.test.d.ts.map +1 -0
- package/dist/differenceInHours.d.ts +37 -0
- package/dist/differenceInHours.d.ts.map +1 -0
- package/dist/differenceInHours.js +8 -0
- package/dist/differenceInHours.js.map +1 -0
- package/dist/differenceInHours.test.d.ts +2 -0
- package/dist/differenceInHours.test.d.ts.map +1 -0
- package/dist/differenceInMicroseconds.d.ts +37 -0
- package/dist/differenceInMicroseconds.d.ts.map +1 -0
- package/dist/differenceInMicroseconds.js +8 -0
- package/dist/differenceInMicroseconds.js.map +1 -0
- package/dist/differenceInMicroseconds.test.d.ts +2 -0
- package/dist/differenceInMicroseconds.test.d.ts.map +1 -0
- package/dist/differenceInMilliseconds.d.ts +37 -0
- package/dist/differenceInMilliseconds.d.ts.map +1 -0
- package/dist/differenceInMilliseconds.js +8 -0
- package/dist/differenceInMilliseconds.js.map +1 -0
- package/dist/differenceInMilliseconds.test.d.ts +2 -0
- package/dist/differenceInMilliseconds.test.d.ts.map +1 -0
- package/dist/differenceInMinutes.d.ts +37 -0
- package/dist/differenceInMinutes.d.ts.map +1 -0
- package/dist/differenceInMinutes.js +8 -0
- package/dist/differenceInMinutes.js.map +1 -0
- package/dist/differenceInMinutes.test.d.ts +2 -0
- package/dist/differenceInMinutes.test.d.ts.map +1 -0
- package/dist/differenceInMonths.d.ts +43 -0
- package/dist/differenceInMonths.d.ts.map +1 -0
- package/dist/differenceInMonths.js +8 -0
- package/dist/differenceInMonths.js.map +1 -0
- package/dist/differenceInMonths.test.d.ts +2 -0
- package/dist/differenceInMonths.test.d.ts.map +1 -0
- package/dist/differenceInNanoseconds.d.ts +37 -0
- package/dist/differenceInNanoseconds.d.ts.map +1 -0
- package/dist/differenceInNanoseconds.js +8 -0
- package/dist/differenceInNanoseconds.js.map +1 -0
- package/dist/differenceInNanoseconds.test.d.ts +2 -0
- package/dist/differenceInNanoseconds.test.d.ts.map +1 -0
- package/dist/differenceInSeconds.d.ts +37 -0
- package/dist/differenceInSeconds.d.ts.map +1 -0
- package/dist/differenceInSeconds.js +8 -0
- package/dist/differenceInSeconds.js.map +1 -0
- package/dist/differenceInSeconds.test.d.ts +2 -0
- package/dist/differenceInSeconds.test.d.ts.map +1 -0
- package/dist/differenceInWeeks.d.ts +43 -0
- package/dist/differenceInWeeks.d.ts.map +1 -0
- package/dist/differenceInWeeks.js +8 -0
- package/dist/differenceInWeeks.js.map +1 -0
- package/dist/differenceInWeeks.test.d.ts +2 -0
- package/dist/differenceInWeeks.test.d.ts.map +1 -0
- package/dist/differenceInYears.d.ts +43 -0
- package/dist/differenceInYears.d.ts.map +1 -0
- package/dist/differenceInYears.js +8 -0
- package/dist/differenceInYears.js.map +1 -0
- package/dist/differenceInYears.test.d.ts +2 -0
- package/dist/differenceInYears.test.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -11
- package/dist/isFuture.d.ts +35 -0
- package/dist/isFuture.d.ts.map +1 -0
- package/dist/isFuture.js +8 -0
- package/dist/isFuture.js.map +1 -0
- package/dist/isFuture.test.d.ts +2 -0
- package/dist/isFuture.test.d.ts.map +1 -0
- package/dist/isPast.d.ts +35 -0
- package/dist/isPast.d.ts.map +1 -0
- package/dist/isPast.js +8 -0
- package/dist/isPast.js.map +1 -0
- package/dist/isPast.test.d.ts +2 -0
- package/dist/isPast.test.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of microseconds between two datetimes.
|
|
4
|
+
* The result is positive if laterDate is after earlierDate, negative if before.
|
|
5
|
+
*
|
|
6
|
+
* @param laterDate - The later datetime (Instant or ZonedDateTime)
|
|
7
|
+
* @param earlierDate - The earlier datetime (Instant or ZonedDateTime)
|
|
8
|
+
* @returns The number of microseconds between the dates
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const later = Temporal.Instant.from('2025-01-20T12:30:20.001000Z');
|
|
13
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:30:20.000000Z');
|
|
14
|
+
*
|
|
15
|
+
* differenceInMicroseconds(later, earlier); // 1000
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Works with ZonedDateTime
|
|
21
|
+
* const later = Temporal.ZonedDateTime.from('2025-01-20T15:00:00.000500-05:00[America/New_York]');
|
|
22
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-01-20T15:00:00.000000-05:00[America/New_York]');
|
|
23
|
+
*
|
|
24
|
+
* differenceInMicroseconds(later, earlier); // 500
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* // Handles different timezones - compares by instant
|
|
30
|
+
* const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');
|
|
31
|
+
* const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');
|
|
32
|
+
*
|
|
33
|
+
* differenceInMicroseconds(tokyo, ny); // 0 (same instant)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function differenceInMicroseconds(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
37
|
+
//# sourceMappingURL=differenceInMicroseconds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInMicroseconds.d.ts","sourceRoot":"","sources":["../src/differenceInMicroseconds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAMR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInMicroseconds.test.d.ts","sourceRoot":"","sources":["../src/differenceInMicroseconds.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of milliseconds between two datetimes.
|
|
4
|
+
* The result is positive if laterDate is after earlierDate, negative if before.
|
|
5
|
+
*
|
|
6
|
+
* @param laterDate - The later datetime (Instant or ZonedDateTime)
|
|
7
|
+
* @param earlierDate - The earlier datetime (Instant or ZonedDateTime)
|
|
8
|
+
* @returns The number of milliseconds between the dates
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const later = Temporal.Instant.from('2025-01-20T12:30:21.700Z');
|
|
13
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:30:20.600Z');
|
|
14
|
+
*
|
|
15
|
+
* differenceInMilliseconds(later, earlier); // 1100
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Works with ZonedDateTime
|
|
21
|
+
* const later = Temporal.ZonedDateTime.from('2025-01-20T15:00:00-05:00[America/New_York]');
|
|
22
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-01-20T14:00:00-05:00[America/New_York]');
|
|
23
|
+
*
|
|
24
|
+
* differenceInMilliseconds(later, earlier); // 3600000
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* // Handles different timezones - compares by instant
|
|
30
|
+
* const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');
|
|
31
|
+
* const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');
|
|
32
|
+
*
|
|
33
|
+
* differenceInMilliseconds(tokyo, ny); // 0 (same instant)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function differenceInMilliseconds(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
37
|
+
//# sourceMappingURL=differenceInMilliseconds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInMilliseconds.d.ts","sourceRoot":"","sources":["../src/differenceInMilliseconds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAKR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInMilliseconds.test.d.ts","sourceRoot":"","sources":["../src/differenceInMilliseconds.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of minutes between two datetimes.
|
|
4
|
+
* The result is positive if laterDate is after earlierDate, negative if before.
|
|
5
|
+
*
|
|
6
|
+
* @param laterDate - The later datetime (Instant or ZonedDateTime)
|
|
7
|
+
* @param earlierDate - The earlier datetime (Instant or ZonedDateTime)
|
|
8
|
+
* @returns The number of minutes between the dates
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const later = Temporal.Instant.from('2025-01-20T12:45:00Z');
|
|
13
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:30:00Z');
|
|
14
|
+
*
|
|
15
|
+
* differenceInMinutes(later, earlier); // 15
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Works with ZonedDateTime
|
|
21
|
+
* const later = Temporal.ZonedDateTime.from('2025-01-20T16:00:00-05:00[America/New_York]');
|
|
22
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-01-20T15:00:00-05:00[America/New_York]');
|
|
23
|
+
*
|
|
24
|
+
* differenceInMinutes(later, earlier); // 60
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* // Handles different timezones - compares by instant
|
|
30
|
+
* const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');
|
|
31
|
+
* const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');
|
|
32
|
+
*
|
|
33
|
+
* differenceInMinutes(tokyo, ny); // 0 (same instant)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function differenceInMinutes(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
37
|
+
//# sourceMappingURL=differenceInMinutes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInMinutes.d.ts","sourceRoot":"","sources":["../src/differenceInMinutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAKR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInMinutes.test.d.ts","sourceRoot":"","sources":["../src/differenceInMinutes.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of months between two datetimes.
|
|
4
|
+
* The result is positive if laterDate is after earlierDate, negative if before.
|
|
5
|
+
*
|
|
6
|
+
* This function uses calendar-aware calculation, which means it properly handles
|
|
7
|
+
* months with different numbers of days (28, 29, 30, or 31).
|
|
8
|
+
*
|
|
9
|
+
* Instant inputs are converted to UTC for calendar calculations.
|
|
10
|
+
* For ZonedDateTime inputs, their timezone is preserved.
|
|
11
|
+
*
|
|
12
|
+
* @param laterDate - The later datetime (Instant or ZonedDateTime)
|
|
13
|
+
* @param earlierDate - The earlier datetime (Instant or ZonedDateTime)
|
|
14
|
+
* @returns The number of months between the dates
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const later = Temporal.Instant.from('2025-04-20T12:00:00Z');
|
|
19
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
20
|
+
*
|
|
21
|
+
* differenceInMonths(later, earlier); // 3
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Works with ZonedDateTime
|
|
27
|
+
* const later = Temporal.ZonedDateTime.from('2025-06-15T15:00:00-05:00[America/New_York]');
|
|
28
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-01-15T15:00:00-05:00[America/New_York]');
|
|
29
|
+
*
|
|
30
|
+
* differenceInMonths(later, earlier); // 5
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Returns fractional months for partial month differences
|
|
36
|
+
* const later = Temporal.Instant.from('2025-02-05T12:00:00Z');
|
|
37
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
38
|
+
*
|
|
39
|
+
* differenceInMonths(later, earlier); // ~0.5 (approximately half a month)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function differenceInMonths(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
43
|
+
//# sourceMappingURL=differenceInMonths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInMonths.d.ts","sourceRoot":"","sources":["../src/differenceInMonths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAMR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInMonths.test.d.ts","sourceRoot":"","sources":["../src/differenceInMonths.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of nanoseconds between two datetimes.
|
|
4
|
+
* The result is positive if laterDate is after earlierDate, negative if before.
|
|
5
|
+
*
|
|
6
|
+
* @param laterDate - The later datetime (Instant or ZonedDateTime)
|
|
7
|
+
* @param earlierDate - The earlier datetime (Instant or ZonedDateTime)
|
|
8
|
+
* @returns The number of nanoseconds between the dates as a BigInt
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const later = Temporal.Instant.from('2025-01-20T12:30:20.000000500Z');
|
|
13
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:30:20.000000000Z');
|
|
14
|
+
*
|
|
15
|
+
* differenceInNanoseconds(later, earlier); // 500n
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Works with ZonedDateTime
|
|
21
|
+
* const later = Temporal.ZonedDateTime.from('2025-01-20T15:00:00.000000001-05:00[America/New_York]');
|
|
22
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-01-20T15:00:00.000000000-05:00[America/New_York]');
|
|
23
|
+
*
|
|
24
|
+
* differenceInNanoseconds(later, earlier); // 1n
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* // Handles different timezones - compares by instant
|
|
30
|
+
* const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');
|
|
31
|
+
* const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');
|
|
32
|
+
*
|
|
33
|
+
* differenceInNanoseconds(tokyo, ny); // 0n (same instant)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function differenceInNanoseconds(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): bigint;
|
|
37
|
+
//# sourceMappingURL=differenceInNanoseconds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInNanoseconds.d.ts","sourceRoot":"","sources":["../src/differenceInNanoseconds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAKR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInNanoseconds.test.d.ts","sourceRoot":"","sources":["../src/differenceInNanoseconds.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of seconds between two datetimes.
|
|
4
|
+
* The result is positive if laterDate is after earlierDate, negative if before.
|
|
5
|
+
*
|
|
6
|
+
* @param laterDate - The later datetime (Instant or ZonedDateTime)
|
|
7
|
+
* @param earlierDate - The earlier datetime (Instant or ZonedDateTime)
|
|
8
|
+
* @returns The number of seconds between the dates
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const later = Temporal.Instant.from('2025-01-20T12:30:25Z');
|
|
13
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:30:20Z');
|
|
14
|
+
*
|
|
15
|
+
* differenceInSeconds(later, earlier); // 5
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Works with ZonedDateTime
|
|
21
|
+
* const later = Temporal.ZonedDateTime.from('2025-01-20T15:01:00-05:00[America/New_York]');
|
|
22
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-01-20T15:00:00-05:00[America/New_York]');
|
|
23
|
+
*
|
|
24
|
+
* differenceInSeconds(later, earlier); // 60
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* // Handles different timezones - compares by instant
|
|
30
|
+
* const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');
|
|
31
|
+
* const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');
|
|
32
|
+
*
|
|
33
|
+
* differenceInSeconds(tokyo, ny); // 0 (same instant)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function differenceInSeconds(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
37
|
+
//# sourceMappingURL=differenceInSeconds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInSeconds.d.ts","sourceRoot":"","sources":["../src/differenceInSeconds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAKR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInSeconds.test.d.ts","sourceRoot":"","sources":["../src/differenceInSeconds.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of weeks between two datetimes.
|
|
4
|
+
* The result is positive if laterDate is after earlierDate, negative if before.
|
|
5
|
+
*
|
|
6
|
+
* This function uses calendar-aware calculation, which means it properly handles
|
|
7
|
+
* DST transitions and calendar weeks.
|
|
8
|
+
*
|
|
9
|
+
* Instant inputs are converted to UTC for calendar calculations.
|
|
10
|
+
* For ZonedDateTime inputs, their timezone is preserved.
|
|
11
|
+
*
|
|
12
|
+
* @param laterDate - The later datetime (Instant or ZonedDateTime)
|
|
13
|
+
* @param earlierDate - The earlier datetime (Instant or ZonedDateTime)
|
|
14
|
+
* @returns The number of weeks between the dates
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const later = Temporal.Instant.from('2025-02-10T12:00:00Z');
|
|
19
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
20
|
+
*
|
|
21
|
+
* differenceInWeeks(later, earlier); // 3
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Works with ZonedDateTime
|
|
27
|
+
* const later = Temporal.ZonedDateTime.from('2025-02-10T15:00:00-05:00[America/New_York]');
|
|
28
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-01-20T15:00:00-05:00[America/New_York]');
|
|
29
|
+
*
|
|
30
|
+
* differenceInWeeks(later, earlier); // 3
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Returns fractional weeks for partial week differences
|
|
36
|
+
* const later = Temporal.Instant.from('2025-01-27T12:00:00Z');
|
|
37
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
38
|
+
*
|
|
39
|
+
* differenceInWeeks(later, earlier); // 1
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function differenceInWeeks(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
43
|
+
//# sourceMappingURL=differenceInWeeks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInWeeks.d.ts","sourceRoot":"","sources":["../src/differenceInWeeks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAMR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInWeeks.test.d.ts","sourceRoot":"","sources":["../src/differenceInWeeks.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of years between two datetimes.
|
|
4
|
+
* The result is positive if laterDate is after earlierDate, negative if before.
|
|
5
|
+
*
|
|
6
|
+
* This function uses calendar-aware calculation, which means it properly handles
|
|
7
|
+
* leap years (366 days) and regular years (365 days).
|
|
8
|
+
*
|
|
9
|
+
* Instant inputs are converted to UTC for calendar calculations.
|
|
10
|
+
* For ZonedDateTime inputs, their timezone is preserved.
|
|
11
|
+
*
|
|
12
|
+
* @param laterDate - The later datetime (Instant or ZonedDateTime)
|
|
13
|
+
* @param earlierDate - The earlier datetime (Instant or ZonedDateTime)
|
|
14
|
+
* @returns The number of years between the dates
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const later = Temporal.Instant.from('2028-01-20T12:00:00Z');
|
|
19
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
20
|
+
*
|
|
21
|
+
* differenceInYears(later, earlier); // 3
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Works with ZonedDateTime
|
|
27
|
+
* const later = Temporal.ZonedDateTime.from('2030-06-15T15:00:00-05:00[America/New_York]');
|
|
28
|
+
* const earlier = Temporal.ZonedDateTime.from('2025-06-15T15:00:00-05:00[America/New_York]');
|
|
29
|
+
*
|
|
30
|
+
* differenceInYears(later, earlier); // 5
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Returns fractional years for partial year differences
|
|
36
|
+
* const later = Temporal.Instant.from('2025-07-20T12:00:00Z');
|
|
37
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
38
|
+
*
|
|
39
|
+
* differenceInYears(later, earlier); // ~0.5 (approximately half a year)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function differenceInYears(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
43
|
+
//# sourceMappingURL=differenceInYears.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInYears.d.ts","sourceRoot":"","sources":["../src/differenceInYears.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EACpD,WAAW,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GACrD,MAAM,CAMR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInYears.test.d.ts","sourceRoot":"","sources":["../src/differenceInYears.test.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,5 +14,17 @@ export { startOfYear } from './startOfYear';
|
|
|
14
14
|
export { endOfYear } from './endOfYear';
|
|
15
15
|
export { isBefore } from './isBefore';
|
|
16
16
|
export { isAfter } from './isAfter';
|
|
17
|
+
export { isFuture } from './isFuture';
|
|
18
|
+
export { isPast } from './isPast';
|
|
17
19
|
export { isSameDay } from './isSameDay';
|
|
20
|
+
export { differenceInNanoseconds } from './differenceInNanoseconds';
|
|
21
|
+
export { differenceInMicroseconds } from './differenceInMicroseconds';
|
|
22
|
+
export { differenceInMilliseconds } from './differenceInMilliseconds';
|
|
23
|
+
export { differenceInSeconds } from './differenceInSeconds';
|
|
24
|
+
export { differenceInMinutes } from './differenceInMinutes';
|
|
25
|
+
export { differenceInHours } from './differenceInHours';
|
|
26
|
+
export { differenceInDays } from './differenceInDays';
|
|
27
|
+
export { differenceInWeeks } from './differenceInWeeks';
|
|
28
|
+
export { differenceInMonths } from './differenceInMonths';
|
|
29
|
+
export { differenceInYears } from './differenceInYears';
|
|
18
30
|
//# 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;AACtD,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,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"}
|
|
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,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,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,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|