@gobrand/tiempo 2.2.1 → 2.2.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 +234 -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-NL5LWPJI.js +94 -0
- package/dist/chunk-NL5LWPJI.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 +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -14
- package/dist/intlFormatDistance.d.ts +85 -0
- package/dist/intlFormatDistance.d.ts.map +1 -0
- package/dist/intlFormatDistance.js +15 -0
- package/dist/intlFormatDistance.js.map +1 -0
- package/dist/intlFormatDistance.test.d.ts +2 -0
- package/dist/intlFormatDistance.test.d.ts.map +1 -0
- 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,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeTemporalInput
|
|
3
|
+
} from "./chunk-MJSZNWCV.js";
|
|
4
|
+
|
|
5
|
+
// src/differenceInMicroseconds.ts
|
|
6
|
+
import "@js-temporal/polyfill";
|
|
7
|
+
function differenceInMicroseconds(laterDate, earlierDate) {
|
|
8
|
+
const zoned1 = normalizeTemporalInput(laterDate);
|
|
9
|
+
const zoned2 = normalizeTemporalInput(earlierDate);
|
|
10
|
+
const diffNanos = zoned1.epochNanoseconds - zoned2.epochNanoseconds;
|
|
11
|
+
return Number(diffNanos / 1000n);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
differenceInMicroseconds
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-ZGR4NZTS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/differenceInMicroseconds.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns the number of microseconds between two datetimes.\n * The result is positive if laterDate is after earlierDate, negative if before.\n *\n * @param laterDate - The later datetime (Instant or ZonedDateTime)\n * @param earlierDate - The earlier datetime (Instant or ZonedDateTime)\n * @returns The number of microseconds between the dates\n *\n * @example\n * ```ts\n * const later = Temporal.Instant.from('2025-01-20T12:30:20.001000Z');\n * const earlier = Temporal.Instant.from('2025-01-20T12:30:20.000000Z');\n *\n * differenceInMicroseconds(later, earlier); // 1000\n * ```\n *\n * @example\n * ```ts\n * // Works with ZonedDateTime\n * const later = Temporal.ZonedDateTime.from('2025-01-20T15:00:00.000500-05:00[America/New_York]');\n * const earlier = Temporal.ZonedDateTime.from('2025-01-20T15:00:00.000000-05:00[America/New_York]');\n *\n * differenceInMicroseconds(later, earlier); // 500\n * ```\n *\n * @example\n * ```ts\n * // Handles different timezones - compares by instant\n * const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');\n * const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');\n *\n * differenceInMicroseconds(tokyo, ny); // 0 (same instant)\n * ```\n */\nexport function differenceInMicroseconds(\n laterDate: Temporal.Instant | Temporal.ZonedDateTime,\n earlierDate: Temporal.Instant | Temporal.ZonedDateTime\n): number {\n const zoned1 = normalizeTemporalInput(laterDate);\n const zoned2 = normalizeTemporalInput(earlierDate);\n\n const diffNanos = zoned1.epochNanoseconds - zoned2.epochNanoseconds;\n return Number(diffNanos / 1000n);\n}\n"],"mappings":";;;;;AAAA,OAAyB;AAqClB,SAAS,yBACd,WACA,aACQ;AACR,QAAM,SAAS,uBAAuB,SAAS;AAC/C,QAAM,SAAS,uBAAuB,WAAW;AAEjD,QAAM,YAAY,OAAO,mBAAmB,OAAO;AACnD,SAAO,OAAO,YAAY,KAAK;AACjC;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeTemporalInput
|
|
3
|
+
} from "./chunk-MJSZNWCV.js";
|
|
4
|
+
|
|
5
|
+
// src/differenceInSeconds.ts
|
|
6
|
+
import "@js-temporal/polyfill";
|
|
7
|
+
function differenceInSeconds(laterDate, earlierDate) {
|
|
8
|
+
const zoned1 = normalizeTemporalInput(laterDate);
|
|
9
|
+
const zoned2 = normalizeTemporalInput(earlierDate);
|
|
10
|
+
return Math.trunc((zoned1.epochMilliseconds - zoned2.epochMilliseconds) / 1e3);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
differenceInSeconds
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-ZHRMURYP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/differenceInSeconds.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns the number of seconds between two datetimes.\n * The result is positive if laterDate is after earlierDate, negative if before.\n *\n * @param laterDate - The later datetime (Instant or ZonedDateTime)\n * @param earlierDate - The earlier datetime (Instant or ZonedDateTime)\n * @returns The number of seconds between the dates\n *\n * @example\n * ```ts\n * const later = Temporal.Instant.from('2025-01-20T12:30:25Z');\n * const earlier = Temporal.Instant.from('2025-01-20T12:30:20Z');\n *\n * differenceInSeconds(later, earlier); // 5\n * ```\n *\n * @example\n * ```ts\n * // Works with ZonedDateTime\n * const later = Temporal.ZonedDateTime.from('2025-01-20T15:01:00-05:00[America/New_York]');\n * const earlier = Temporal.ZonedDateTime.from('2025-01-20T15:00:00-05:00[America/New_York]');\n *\n * differenceInSeconds(later, earlier); // 60\n * ```\n *\n * @example\n * ```ts\n * // Handles different timezones - compares by instant\n * const tokyo = Temporal.ZonedDateTime.from('2025-01-21T00:00:00+09:00[Asia/Tokyo]');\n * const ny = Temporal.ZonedDateTime.from('2025-01-20T10:00:00-05:00[America/New_York]');\n *\n * differenceInSeconds(tokyo, ny); // 0 (same instant)\n * ```\n */\nexport function differenceInSeconds(\n laterDate: Temporal.Instant | Temporal.ZonedDateTime,\n earlierDate: Temporal.Instant | Temporal.ZonedDateTime\n): number {\n const zoned1 = normalizeTemporalInput(laterDate);\n const zoned2 = normalizeTemporalInput(earlierDate);\n\n return Math.trunc((zoned1.epochMilliseconds - zoned2.epochMilliseconds) / 1000);\n}\n"],"mappings":";;;;;AAAA,OAAyB;AAqClB,SAAS,oBACd,WACA,aACQ;AACR,QAAM,SAAS,uBAAuB,SAAS;AAC/C,QAAM,SAAS,uBAAuB,WAAW;AAEjD,SAAO,KAAK,OAAO,OAAO,oBAAoB,OAAO,qBAAqB,GAAI;AAChF;","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of days 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 where days can be 23, 24, or 25 hours long.
|
|
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 days between the dates
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const later = Temporal.Instant.from('2025-01-25T12:00:00Z');
|
|
19
|
+
* const earlier = Temporal.Instant.from('2025-01-20T12:00:00Z');
|
|
20
|
+
*
|
|
21
|
+
* differenceInDays(later, earlier); // 5
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Works with ZonedDateTime
|
|
27
|
+
* const later = Temporal.ZonedDateTime.from('2025-01-25T15: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
|
+
* differenceInDays(later, earlier); // 5
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Handles DST transitions correctly
|
|
36
|
+
* const afterDst = Temporal.ZonedDateTime.from('2025-03-10T12:00:00-04:00[America/New_York]');
|
|
37
|
+
* const beforeDst = Temporal.ZonedDateTime.from('2025-03-08T12:00:00-05:00[America/New_York]');
|
|
38
|
+
*
|
|
39
|
+
* differenceInDays(afterDst, beforeDst); // 2 (calendar days, not 48 hours)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function differenceInDays(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
43
|
+
//# sourceMappingURL=differenceInDays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInDays.d.ts","sourceRoot":"","sources":["../src/differenceInDays.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,gBAAgB,CAC9B,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":"differenceInDays.test.d.ts","sourceRoot":"","sources":["../src/differenceInDays.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the number of hours 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 hours between the dates
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const later = Temporal.Instant.from('2025-01-20T18:00:00Z');
|
|
13
|
+
* const earlier = Temporal.Instant.from('2025-01-20T15:00:00Z');
|
|
14
|
+
*
|
|
15
|
+
* differenceInHours(later, earlier); // 3
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Works with ZonedDateTime
|
|
21
|
+
* const later = Temporal.ZonedDateTime.from('2025-01-21T00: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
|
+
* differenceInHours(later, earlier); // 9
|
|
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
|
+
* differenceInHours(tokyo, ny); // 0 (same instant)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function differenceInHours(laterDate: Temporal.Instant | Temporal.ZonedDateTime, earlierDate: Temporal.Instant | Temporal.ZonedDateTime): number;
|
|
37
|
+
//# sourceMappingURL=differenceInHours.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInHours.d.ts","sourceRoot":"","sources":["../src/differenceInHours.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;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,CAKR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"differenceInHours.test.d.ts","sourceRoot":"","sources":["../src/differenceInHours.test.ts"],"names":[],"mappings":""}
|
|
@@ -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":""}
|