@gobrand/tiempo 2.5.3 → 2.6.0
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/dist/chunk-7GEIOKVQ.js +19 -0
- package/dist/chunk-7GEIOKVQ.js.map +1 -0
- package/dist/chunk-EZ7NVTZI.js +21 -0
- package/dist/chunk-EZ7NVTZI.js.map +1 -0
- package/dist/chunk-GFWC7CHD.js +21 -0
- package/dist/chunk-GFWC7CHD.js.map +1 -0
- package/dist/{chunk-XDVUGTUV.js → chunk-GLGAVKGV.js} +7 -3
- package/dist/chunk-GLGAVKGV.js.map +1 -0
- package/dist/chunk-HFQUXON5.js +41 -0
- package/dist/chunk-HFQUXON5.js.map +1 -0
- package/dist/chunk-ID52RFFD.js +19 -0
- package/dist/chunk-ID52RFFD.js.map +1 -0
- package/dist/chunk-JHRXY36W.js +25 -0
- package/dist/chunk-JHRXY36W.js.map +1 -0
- package/dist/chunk-JNA3AFOC.js +13 -0
- package/dist/chunk-JNA3AFOC.js.map +1 -0
- package/dist/chunk-MMI2HHT7.js +25 -0
- package/dist/chunk-MMI2HHT7.js.map +1 -0
- package/dist/chunk-PWISCOZV.js +23 -0
- package/dist/chunk-PWISCOZV.js.map +1 -0
- package/dist/chunk-UJW2FPI4.js +25 -0
- package/dist/chunk-UJW2FPI4.js.map +1 -0
- package/dist/chunk-UJWM2BV2.js +41 -0
- package/dist/chunk-UJWM2BV2.js.map +1 -0
- package/dist/chunk-X26WIJ6L.js +24 -0
- package/dist/chunk-X26WIJ6L.js.map +1 -0
- package/dist/chunk-XPJFOBPW.js +24 -0
- package/dist/chunk-XPJFOBPW.js.map +1 -0
- package/dist/endOfDay.d.ts +5 -4
- package/dist/endOfDay.d.ts.map +1 -1
- package/dist/endOfDay.js +2 -1
- package/dist/endOfMonth.d.ts +7 -6
- package/dist/endOfMonth.d.ts.map +1 -1
- package/dist/endOfMonth.js +2 -1
- package/dist/endOfWeek.d.ts +7 -6
- package/dist/endOfWeek.d.ts.map +1 -1
- package/dist/endOfWeek.js +2 -1
- package/dist/endOfYear.d.ts +6 -5
- package/dist/endOfYear.d.ts.map +1 -1
- package/dist/endOfYear.js +2 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -30
- package/dist/roundToNearestHour.d.ts +77 -0
- package/dist/roundToNearestHour.d.ts.map +1 -0
- package/dist/roundToNearestHour.js +8 -0
- package/dist/roundToNearestHour.js.map +1 -0
- package/dist/roundToNearestHour.test.d.ts +2 -0
- package/dist/roundToNearestHour.test.d.ts.map +1 -0
- package/dist/roundToNearestMinute.d.ts +76 -0
- package/dist/roundToNearestMinute.d.ts.map +1 -0
- package/dist/roundToNearestMinute.js +8 -0
- package/dist/roundToNearestMinute.js.map +1 -0
- package/dist/roundToNearestMinute.test.d.ts +2 -0
- package/dist/roundToNearestMinute.test.d.ts.map +1 -0
- package/dist/roundToNearestSecond.d.ts +75 -0
- package/dist/roundToNearestSecond.d.ts.map +1 -0
- package/dist/roundToNearestSecond.js +8 -0
- package/dist/roundToNearestSecond.js.map +1 -0
- package/dist/roundToNearestSecond.test.d.ts +2 -0
- package/dist/roundToNearestSecond.test.d.ts.map +1 -0
- package/dist/shared/plainDateToZonedDateTime.d.ts +9 -0
- package/dist/shared/plainDateToZonedDateTime.d.ts.map +1 -0
- package/dist/shared/plainDateToZonedDateTime.js +7 -0
- package/dist/shared/plainDateToZonedDateTime.js.map +1 -0
- package/dist/startOfDay.d.ts +6 -5
- package/dist/startOfDay.d.ts.map +1 -1
- package/dist/startOfDay.js +2 -1
- package/dist/startOfMonth.d.ts +6 -5
- package/dist/startOfMonth.d.ts.map +1 -1
- package/dist/startOfMonth.js +2 -1
- package/dist/startOfWeek.d.ts +7 -6
- package/dist/startOfWeek.d.ts.map +1 -1
- package/dist/startOfWeek.js +2 -1
- package/dist/startOfYear.d.ts +6 -5
- package/dist/startOfYear.d.ts.map +1 -1
- package/dist/startOfYear.js +2 -1
- package/dist/toPlainDate.d.ts +14 -7
- package/dist/toPlainDate.d.ts.map +1 -1
- package/dist/toPlainDate.js +1 -1
- package/dist/toPlainTime.d.ts +15 -7
- package/dist/toPlainTime.d.ts.map +1 -1
- package/dist/toPlainTime.js +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2WMXB7QL.js +0 -17
- package/dist/chunk-2WMXB7QL.js.map +0 -1
- package/dist/chunk-CUMB4776.js +0 -18
- package/dist/chunk-CUMB4776.js.map +0 -1
- package/dist/chunk-G45S5B4O.js +0 -25
- package/dist/chunk-G45S5B4O.js.map +0 -1
- package/dist/chunk-GM6RNAYE.js +0 -19
- package/dist/chunk-GM6RNAYE.js.map +0 -1
- package/dist/chunk-TU2UNOOW.js +0 -15
- package/dist/chunk-TU2UNOOW.js.map +0 -1
- package/dist/chunk-TW5EV3DH.js +0 -14
- package/dist/chunk-TW5EV3DH.js.map +0 -1
- package/dist/chunk-UCCWUJ2K.js +0 -25
- package/dist/chunk-UCCWUJ2K.js.map +0 -1
- package/dist/chunk-XDVUGTUV.js.map +0 -1
- package/dist/chunk-XVJJR7H6.js +0 -20
- package/dist/chunk-XVJJR7H6.js.map +0 -1
- package/dist/chunk-YR2UCUIT.js +0 -15
- package/dist/chunk-YR2UCUIT.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startOfWeek.d.ts","sourceRoot":"","sources":["../src/startOfWeek.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"startOfWeek.d.ts","sourceRoot":"","sources":["../src/startOfWeek.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,aAAa,CAAC"}
|
package/dist/startOfWeek.js
CHANGED
package/dist/startOfYear.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
import type { Timezone } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Returns a ZonedDateTime representing the first moment of the year (January 1 at midnight).
|
|
4
5
|
*
|
|
@@ -23,12 +24,12 @@ import type { Temporal } from '@js-temporal/polyfill';
|
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
26
|
* ```ts
|
|
26
|
-
* //
|
|
27
|
-
* const
|
|
28
|
-
* const
|
|
29
|
-
* const start = startOfYear(nyTime);
|
|
27
|
+
* // From PlainDate (requires timezone)
|
|
28
|
+
* const date = Temporal.PlainDate.from('2025-06-15');
|
|
29
|
+
* const start = startOfYear(date, 'America/New_York');
|
|
30
30
|
* // 2025-01-01T00:00:00-05:00[America/New_York]
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
export declare function startOfYear(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
|
|
34
|
+
export declare function startOfYear(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
|
|
34
35
|
//# sourceMappingURL=startOfYear.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startOfYear.d.ts","sourceRoot":"","sources":["../src/startOfYear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"startOfYear.d.ts","sourceRoot":"","sources":["../src/startOfYear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,aAAa,CAAC"}
|
package/dist/startOfYear.js
CHANGED
package/dist/toPlainDate.d.ts
CHANGED
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
import { Temporal } from '@js-temporal/polyfill';
|
|
2
2
|
import type { Timezone } from './types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Parse a plain date or extract the calendar date from a datetime.
|
|
5
5
|
*
|
|
6
|
-
* @param input - A
|
|
7
|
-
* @param timezone - IANA timezone identifier. Required
|
|
6
|
+
* @param input - A PlainDateLike object, plain date string (YYYY-MM-DD), ZonedDateTime, or datetime input requiring timezone
|
|
7
|
+
* @param timezone - IANA timezone identifier. Required for ISO strings, Date, and Instant inputs.
|
|
8
8
|
* @returns A Temporal.PlainDate representing the calendar date
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
12
|
* import { toPlainDate, toZonedTime } from '@gobrand/tiempo';
|
|
13
13
|
*
|
|
14
|
+
* // From PlainDateLike object (no timezone needed)
|
|
15
|
+
* const date = toPlainDate({ year: 2025, month: 1, day: 20 }); // 2025-01-20
|
|
16
|
+
*
|
|
17
|
+
* // From plain date string (no timezone needed)
|
|
18
|
+
* const date2 = toPlainDate("2025-01-20"); // 2025-01-20
|
|
19
|
+
*
|
|
14
20
|
* // From ZonedDateTime (no timezone needed)
|
|
15
21
|
* const zdt = toZonedTime("2025-01-20T15:30:00Z", "America/New_York");
|
|
16
|
-
* const
|
|
22
|
+
* const date3 = toPlainDate(zdt); // 2025-01-20
|
|
17
23
|
*
|
|
18
24
|
* // From UTC string with timezone
|
|
19
|
-
* const
|
|
25
|
+
* const date4 = toPlainDate("2025-01-20T15:30:00Z", "America/New_York"); // 2025-01-20
|
|
20
26
|
*
|
|
21
27
|
* // From Date with timezone
|
|
22
28
|
* const jsDate = new Date("2025-01-20T15:30:00.000Z");
|
|
23
|
-
* const
|
|
29
|
+
* const date5 = toPlainDate(jsDate, "Europe/London"); // 2025-01-20
|
|
24
30
|
*
|
|
25
31
|
* // Date boundary crossing: 23:00 UTC on Jan 20 → Jan 21 in Tokyo
|
|
26
|
-
* const
|
|
32
|
+
* const date6 = toPlainDate("2025-01-20T23:00:00Z", "Asia/Tokyo"); // 2025-01-21
|
|
27
33
|
* ```
|
|
28
34
|
*/
|
|
29
35
|
export declare function toPlainDate(input: Temporal.ZonedDateTime): Temporal.PlainDate;
|
|
30
36
|
export declare function toPlainDate(input: string | Date | Temporal.Instant | Temporal.ZonedDateTime, timezone: Timezone): Temporal.PlainDate;
|
|
37
|
+
export declare function toPlainDate(input: Temporal.PlainDateLike | string): Temporal.PlainDate;
|
|
31
38
|
//# sourceMappingURL=toPlainDate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toPlainDate.d.ts","sourceRoot":"","sources":["../src/toPlainDate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"toPlainDate.d.ts","sourceRoot":"","sources":["../src/toPlainDate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC/E,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChE,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,SAAS,CAAC;AACtB,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC"}
|
package/dist/toPlainDate.js
CHANGED
package/dist/toPlainTime.d.ts
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
import { Temporal } from '@js-temporal/polyfill';
|
|
2
2
|
import type { Timezone } from './types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Parse a plain time or extract the wall-clock time from a datetime.
|
|
5
5
|
*
|
|
6
|
-
* @param input - A
|
|
7
|
-
* @param timezone - IANA timezone identifier. Required
|
|
6
|
+
* @param input - A PlainTimeLike object, plain time string (HH:MM or HH:MM:SS), ZonedDateTime, or datetime input requiring timezone
|
|
7
|
+
* @param timezone - IANA timezone identifier. Required for ISO strings, Date, and Instant inputs.
|
|
8
8
|
* @returns A Temporal.PlainTime representing the wall-clock time
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
12
|
* import { toPlainTime, toZonedTime } from '@gobrand/tiempo';
|
|
13
13
|
*
|
|
14
|
+
* // From PlainTimeLike object (no timezone needed)
|
|
15
|
+
* const time = toPlainTime({ hour: 14, minute: 30 }); // 14:30
|
|
16
|
+
*
|
|
17
|
+
* // From plain time string (no timezone needed)
|
|
18
|
+
* const time2 = toPlainTime("14:30"); // 14:30
|
|
19
|
+
* const timeWithSeconds = toPlainTime("14:30:45"); // 14:30:45
|
|
20
|
+
*
|
|
14
21
|
* // From ZonedDateTime (no timezone needed)
|
|
15
22
|
* const zdt = toZonedTime("2025-01-20T15:30:00Z", "America/New_York");
|
|
16
|
-
* const
|
|
23
|
+
* const time3 = toPlainTime(zdt); // 10:30
|
|
17
24
|
*
|
|
18
25
|
* // From UTC string with timezone
|
|
19
|
-
* const
|
|
26
|
+
* const time4 = toPlainTime("2025-01-20T15:30:00Z", "America/New_York"); // 10:30
|
|
20
27
|
*
|
|
21
28
|
* // From Date with timezone
|
|
22
29
|
* const date = new Date("2025-01-20T15:30:00.000Z");
|
|
23
|
-
* const
|
|
30
|
+
* const time5 = toPlainTime(date, "Europe/London"); // 15:30
|
|
24
31
|
*
|
|
25
32
|
* // From Instant with timezone
|
|
26
33
|
* const instant = Temporal.Instant.from("2025-01-20T15:30:00Z");
|
|
27
|
-
* const
|
|
34
|
+
* const time6 = toPlainTime(instant, "Asia/Tokyo"); // 00:30
|
|
28
35
|
* ```
|
|
29
36
|
*/
|
|
30
37
|
export declare function toPlainTime(input: Temporal.ZonedDateTime): Temporal.PlainTime;
|
|
31
38
|
export declare function toPlainTime(input: string | Date | Temporal.Instant | Temporal.ZonedDateTime, timezone: Timezone): Temporal.PlainTime;
|
|
39
|
+
export declare function toPlainTime(input: Temporal.PlainTimeLike | string): Temporal.PlainTime;
|
|
32
40
|
//# sourceMappingURL=toPlainTime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toPlainTime.d.ts","sourceRoot":"","sources":["../src/toPlainTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"toPlainTime.d.ts","sourceRoot":"","sources":["../src/toPlainTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC/E,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,EAChE,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,SAAS,CAAC;AACtB,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC"}
|
package/dist/toPlainTime.js
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,YAAY,CAAC;AAE5C,YAAY,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,YAAY,CAAC;AAE5C,YAAY,EAAE,YAAY,EAAE,CAAC"}
|
package/package.json
CHANGED
package/dist/chunk-2WMXB7QL.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeTemporalInput
|
|
3
|
-
} from "./chunk-MJSZNWCV.js";
|
|
4
|
-
|
|
5
|
-
// src/startOfWeek.ts
|
|
6
|
-
function startOfWeek(input) {
|
|
7
|
-
const zonedDateTime = normalizeTemporalInput(input);
|
|
8
|
-
const dayOfWeek = zonedDateTime.dayOfWeek;
|
|
9
|
-
const daysToSubtract = dayOfWeek - 1;
|
|
10
|
-
const monday = zonedDateTime.subtract({ days: daysToSubtract });
|
|
11
|
-
return monday.startOfDay();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
startOfWeek
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=chunk-2WMXB7QL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/startOfWeek.ts"],"sourcesContent":["import type { Temporal } from '@js-temporal/polyfill';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns a ZonedDateTime representing the first moment of the week (Monday at midnight).\n * Uses ISO 8601 week definition: weeks start on Monday.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at Monday 00:00:00.000000000\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z'); // Monday\n * const start = startOfWeek(instant);\n * // 2025-01-20T00:00:00Z[UTC] (same day, it's already Monday)\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-01-22T15:30:00-05:00[America/New_York]'); // Wednesday\n * const start = startOfWeek(zoned);\n * // 2025-01-20T00:00:00-05:00[America/New_York] (previous Monday)\n * ```\n *\n * @example\n * ```ts\n * // Need a different timezone? Convert first\n * const instant = Temporal.Instant.from('2025-01-22T12:00:00Z');\n * const nyTime = instant.toZonedDateTimeISO('America/New_York');\n * const start = startOfWeek(nyTime);\n * // 2025-01-20T00:00:00-05:00[America/New_York]\n * ```\n */\nexport function startOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime {\n const zonedDateTime = normalizeTemporalInput(input);\n\n // Get the day of week (1 = Monday, 7 = Sunday in ISO 8601)\n const dayOfWeek = zonedDateTime.dayOfWeek;\n\n // Calculate days to subtract to get to Monday\n const daysToSubtract = dayOfWeek - 1;\n\n // Go to Monday, then get start of that day\n const monday = zonedDateTime.subtract({ days: daysToSubtract });\n\n return monday.startOfDay();\n}\n"],"mappings":";;;;;AAmCO,SAAS,YACd,OACwB;AACxB,QAAM,gBAAgB,uBAAuB,KAAK;AAGlD,QAAM,YAAY,cAAc;AAGhC,QAAM,iBAAiB,YAAY;AAGnC,QAAM,SAAS,cAAc,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9D,SAAO,OAAO,WAAW;AAC3B;","names":[]}
|
package/dist/chunk-CUMB4776.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getEndOfDay
|
|
3
|
-
} from "./chunk-AVGNRINZ.js";
|
|
4
|
-
import {
|
|
5
|
-
normalizeTemporalInput
|
|
6
|
-
} from "./chunk-MJSZNWCV.js";
|
|
7
|
-
|
|
8
|
-
// src/endOfDay.ts
|
|
9
|
-
import "@js-temporal/polyfill";
|
|
10
|
-
function endOfDay(input) {
|
|
11
|
-
const zonedDateTime = normalizeTemporalInput(input);
|
|
12
|
-
return getEndOfDay(zonedDateTime);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
endOfDay
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=chunk-CUMB4776.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/endOfDay.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns a ZonedDateTime representing the last nanosecond of the day.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at 23:59:59.999999999\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');\n * const end = endOfDay(instant);\n * // 2025-01-20T23:59:59.999999999Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-01-20T15:30:00-05:00[America/New_York]');\n * const end = endOfDay(zoned);\n * // 2025-01-20T23:59:59.999999999-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // Need a different timezone? Convert first\n * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');\n * const nyTime = instant.toZonedDateTimeISO('America/New_York');\n * const end = endOfDay(nyTime);\n * // 2025-01-20T23:59:59.999999999-05:00[America/New_York]\n * ```\n */\nexport function endOfDay(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime {\n const zonedDateTime = normalizeTemporalInput(input);\n\n return getEndOfDay(zonedDateTime);\n}\n"],"mappings":";;;;;;;;AAAA,OAAyB;AAmClB,SAAS,SACd,OACwB;AACxB,QAAM,gBAAgB,uBAAuB,KAAK;AAElD,SAAO,YAAY,aAAa;AAClC;","names":[]}
|
package/dist/chunk-G45S5B4O.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/toPlainTime.ts
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
function toPlainTime(input, timezone) {
|
|
4
|
-
if (input instanceof Temporal.ZonedDateTime && timezone === void 0) {
|
|
5
|
-
return input.toPlainTime();
|
|
6
|
-
}
|
|
7
|
-
if (timezone === void 0) {
|
|
8
|
-
throw new Error("Timezone is required unless input is a ZonedDateTime");
|
|
9
|
-
}
|
|
10
|
-
if (typeof input === "string") {
|
|
11
|
-
return Temporal.Instant.from(input).toZonedDateTimeISO(timezone).toPlainTime();
|
|
12
|
-
}
|
|
13
|
-
if (input instanceof Date) {
|
|
14
|
-
return Temporal.Instant.from(input.toISOString()).toZonedDateTimeISO(timezone).toPlainTime();
|
|
15
|
-
}
|
|
16
|
-
if (input instanceof Temporal.Instant) {
|
|
17
|
-
return input.toZonedDateTimeISO(timezone).toPlainTime();
|
|
18
|
-
}
|
|
19
|
-
return input.toInstant().toZonedDateTimeISO(timezone).toPlainTime();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
toPlainTime
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=chunk-G45S5B4O.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/toPlainTime.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\n\n/**\n * Extract the wall-clock time from a ZonedDateTime or convert an input to a timezone and extract the time.\n *\n * @param input - A Temporal.ZonedDateTime (timezone optional) or a UTC ISO string, Date, Instant, or ZonedDateTime (timezone required)\n * @param timezone - IANA timezone identifier. Required unless input is a ZonedDateTime.\n * @returns A Temporal.PlainTime representing the wall-clock time\n *\n * @example\n * ```typescript\n * import { toPlainTime, toZonedTime } from '@gobrand/tiempo';\n *\n * // From ZonedDateTime (no timezone needed)\n * const zdt = toZonedTime(\"2025-01-20T15:30:00Z\", \"America/New_York\");\n * const time = toPlainTime(zdt); // 10:30\n *\n * // From UTC string with timezone\n * const time2 = toPlainTime(\"2025-01-20T15:30:00Z\", \"America/New_York\"); // 10:30\n *\n * // From Date with timezone\n * const date = new Date(\"2025-01-20T15:30:00.000Z\");\n * const time3 = toPlainTime(date, \"Europe/London\"); // 15:30\n *\n * // From Instant with timezone\n * const instant = Temporal.Instant.from(\"2025-01-20T15:30:00Z\");\n * const time4 = toPlainTime(instant, \"Asia/Tokyo\"); // 00:30\n * ```\n */\nexport function toPlainTime(input: Temporal.ZonedDateTime): Temporal.PlainTime;\nexport function toPlainTime(\n input: string | Date | Temporal.Instant | Temporal.ZonedDateTime,\n timezone: Timezone\n): Temporal.PlainTime;\nexport function toPlainTime(\n input: string | Date | Temporal.Instant | Temporal.ZonedDateTime,\n timezone?: Timezone\n): Temporal.PlainTime {\n if (input instanceof Temporal.ZonedDateTime && timezone === undefined) {\n return input.toPlainTime();\n }\n\n if (timezone === undefined) {\n throw new Error('Timezone is required unless input is a ZonedDateTime');\n }\n\n if (typeof input === 'string') {\n return Temporal.Instant.from(input).toZonedDateTimeISO(timezone).toPlainTime();\n }\n\n if (input instanceof Date) {\n return Temporal.Instant.from(input.toISOString()).toZonedDateTimeISO(timezone).toPlainTime();\n }\n\n if (input instanceof Temporal.Instant) {\n return input.toZonedDateTimeISO(timezone).toPlainTime();\n }\n\n return input.toInstant().toZonedDateTimeISO(timezone).toPlainTime();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAmClB,SAAS,YACd,OACA,UACoB;AACpB,MAAI,iBAAiB,SAAS,iBAAiB,aAAa,QAAW;AACrE,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,MAAI,aAAa,QAAW;AAC1B,UAAM,IAAI,MAAM,sDAAsD;AAAA,EACxE;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,SAAS,QAAQ,KAAK,KAAK,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EAC/E;AAEA,MAAI,iBAAiB,MAAM;AACzB,WAAO,SAAS,QAAQ,KAAK,MAAM,YAAY,CAAC,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EAC7F;AAEA,MAAI,iBAAiB,SAAS,SAAS;AACrC,WAAO,MAAM,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EACxD;AAEA,SAAO,MAAM,UAAU,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AACpE;","names":[]}
|
package/dist/chunk-GM6RNAYE.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getEndOfDay
|
|
3
|
-
} from "./chunk-AVGNRINZ.js";
|
|
4
|
-
import {
|
|
5
|
-
normalizeTemporalInput
|
|
6
|
-
} from "./chunk-MJSZNWCV.js";
|
|
7
|
-
|
|
8
|
-
// src/endOfMonth.ts
|
|
9
|
-
function endOfMonth(input) {
|
|
10
|
-
const zonedDateTime = normalizeTemporalInput(input);
|
|
11
|
-
const daysInMonth = zonedDateTime.daysInMonth;
|
|
12
|
-
const lastDay = zonedDateTime.with({ day: daysInMonth });
|
|
13
|
-
return getEndOfDay(lastDay);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
endOfMonth
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=chunk-GM6RNAYE.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/endOfMonth.ts"],"sourcesContent":["import type { Temporal } from '@js-temporal/polyfill';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns a ZonedDateTime representing the last moment of the month (last day at 23:59:59.999999999).\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at the last day of the month at 23:59:59.999999999\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');\n * const end = endOfMonth(instant);\n * // 2025-01-31T23:59:59.999999999Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-02-15T15:30:00-05:00[America/New_York]');\n * const end = endOfMonth(zoned);\n * // 2025-02-28T23:59:59.999999999-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // Need a different timezone? Convert first\n * const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');\n * const nyTime = instant.toZonedDateTimeISO('America/New_York');\n * const end = endOfMonth(nyTime);\n * // 2025-01-31T23:59:59.999999999-05:00[America/New_York]\n * ```\n */\nexport function endOfMonth(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime {\n const zonedDateTime = normalizeTemporalInput(input);\n\n // Get the number of days in this month\n const daysInMonth = zonedDateTime.daysInMonth;\n\n // Set day to last day of month, then get end of that day\n const lastDay = zonedDateTime.with({ day: daysInMonth });\n\n return getEndOfDay(lastDay);\n}\n"],"mappings":";;;;;;;;AAmCO,SAAS,WACd,OACwB;AACxB,QAAM,gBAAgB,uBAAuB,KAAK;AAGlD,QAAM,cAAc,cAAc;AAGlC,QAAM,UAAU,cAAc,KAAK,EAAE,KAAK,YAAY,CAAC;AAEvD,SAAO,YAAY,OAAO;AAC5B;","names":[]}
|
package/dist/chunk-TU2UNOOW.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeTemporalInput
|
|
3
|
-
} from "./chunk-MJSZNWCV.js";
|
|
4
|
-
|
|
5
|
-
// src/startOfMonth.ts
|
|
6
|
-
function startOfMonth(input) {
|
|
7
|
-
const zonedDateTime = normalizeTemporalInput(input);
|
|
8
|
-
const firstDay = zonedDateTime.with({ day: 1 });
|
|
9
|
-
return firstDay.startOfDay();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
startOfMonth
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=chunk-TU2UNOOW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/startOfMonth.ts"],"sourcesContent":["import type { Temporal } from '@js-temporal/polyfill';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns a ZonedDateTime representing the first moment of the month (day 1 at midnight).\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at the 1st day of the month at 00:00:00.000000000\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');\n * const start = startOfMonth(instant);\n * // 2025-01-01T00:00:00Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-01-15T15:30:00-05:00[America/New_York]');\n * const start = startOfMonth(zoned);\n * // 2025-01-01T00:00:00-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // Need a different timezone? Convert first\n * const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');\n * const nyTime = instant.toZonedDateTimeISO('America/New_York');\n * const start = startOfMonth(nyTime);\n * // 2025-01-01T00:00:00-05:00[America/New_York]\n * ```\n */\nexport function startOfMonth(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime {\n const zonedDateTime = normalizeTemporalInput(input);\n\n // Set day to 1, then get start of that day\n const firstDay = zonedDateTime.with({ day: 1 });\n\n return firstDay.startOfDay();\n}\n"],"mappings":";;;;;AAkCO,SAAS,aACd,OACwB;AACxB,QAAM,gBAAgB,uBAAuB,KAAK;AAGlD,QAAM,WAAW,cAAc,KAAK,EAAE,KAAK,EAAE,CAAC;AAE9C,SAAO,SAAS,WAAW;AAC7B;","names":[]}
|
package/dist/chunk-TW5EV3DH.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeTemporalInput
|
|
3
|
-
} from "./chunk-MJSZNWCV.js";
|
|
4
|
-
|
|
5
|
-
// src/startOfDay.ts
|
|
6
|
-
function startOfDay(input) {
|
|
7
|
-
const zonedDateTime = normalizeTemporalInput(input);
|
|
8
|
-
return zonedDateTime.startOfDay();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
startOfDay
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=chunk-TW5EV3DH.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/startOfDay.ts"],"sourcesContent":["import type { Temporal } from '@js-temporal/polyfill';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns a ZonedDateTime representing the first moment of the day (midnight).\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at 00:00:00.000000000\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');\n * const start = startOfDay(instant);\n * // 2025-01-20T00:00:00Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-01-20T15:30:00-05:00[America/New_York]');\n * const start = startOfDay(zoned);\n * // 2025-01-20T00:00:00-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // Need a different timezone? Convert first\n * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');\n * const nyTime = instant.toZonedDateTimeISO('America/New_York');\n * const start = startOfDay(nyTime);\n * // 2025-01-20T00:00:00-05:00[America/New_York]\n * ```\n */\nexport function startOfDay(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime {\n const zonedDateTime = normalizeTemporalInput(input);\n\n return zonedDateTime.startOfDay();\n}\n"],"mappings":";;;;;AAkCO,SAAS,WACd,OACwB;AACxB,QAAM,gBAAgB,uBAAuB,KAAK;AAElD,SAAO,cAAc,WAAW;AAClC;","names":[]}
|
package/dist/chunk-UCCWUJ2K.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/toPlainDate.ts
|
|
2
|
-
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
-
function toPlainDate(input, timezone) {
|
|
4
|
-
if (input instanceof Temporal.ZonedDateTime && timezone === void 0) {
|
|
5
|
-
return input.toPlainDate();
|
|
6
|
-
}
|
|
7
|
-
if (timezone === void 0) {
|
|
8
|
-
throw new Error("Timezone is required unless input is a ZonedDateTime");
|
|
9
|
-
}
|
|
10
|
-
if (typeof input === "string") {
|
|
11
|
-
return Temporal.Instant.from(input).toZonedDateTimeISO(timezone).toPlainDate();
|
|
12
|
-
}
|
|
13
|
-
if (input instanceof Date) {
|
|
14
|
-
return Temporal.Instant.from(input.toISOString()).toZonedDateTimeISO(timezone).toPlainDate();
|
|
15
|
-
}
|
|
16
|
-
if (input instanceof Temporal.Instant) {
|
|
17
|
-
return input.toZonedDateTimeISO(timezone).toPlainDate();
|
|
18
|
-
}
|
|
19
|
-
return input.toInstant().toZonedDateTimeISO(timezone).toPlainDate();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
toPlainDate
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=chunk-UCCWUJ2K.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/toPlainDate.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\n\n/**\n * Extract the calendar date from a ZonedDateTime or convert an input to a timezone and extract the date.\n *\n * @param input - A Temporal.ZonedDateTime (timezone optional) or a UTC ISO string, Date, Instant, or ZonedDateTime (timezone required)\n * @param timezone - IANA timezone identifier. Required unless input is a ZonedDateTime.\n * @returns A Temporal.PlainDate representing the calendar date\n *\n * @example\n * ```typescript\n * import { toPlainDate, toZonedTime } from '@gobrand/tiempo';\n *\n * // From ZonedDateTime (no timezone needed)\n * const zdt = toZonedTime(\"2025-01-20T15:30:00Z\", \"America/New_York\");\n * const date = toPlainDate(zdt); // 2025-01-20\n *\n * // From UTC string with timezone\n * const date2 = toPlainDate(\"2025-01-20T15:30:00Z\", \"America/New_York\"); // 2025-01-20\n *\n * // From Date with timezone\n * const jsDate = new Date(\"2025-01-20T15:30:00.000Z\");\n * const date3 = toPlainDate(jsDate, \"Europe/London\"); // 2025-01-20\n *\n * // Date boundary crossing: 23:00 UTC on Jan 20 → Jan 21 in Tokyo\n * const date4 = toPlainDate(\"2025-01-20T23:00:00Z\", \"Asia/Tokyo\"); // 2025-01-21\n * ```\n */\nexport function toPlainDate(input: Temporal.ZonedDateTime): Temporal.PlainDate;\nexport function toPlainDate(\n input: string | Date | Temporal.Instant | Temporal.ZonedDateTime,\n timezone: Timezone\n): Temporal.PlainDate;\nexport function toPlainDate(\n input: string | Date | Temporal.Instant | Temporal.ZonedDateTime,\n timezone?: Timezone\n): Temporal.PlainDate {\n if (input instanceof Temporal.ZonedDateTime && timezone === undefined) {\n return input.toPlainDate();\n }\n\n if (timezone === undefined) {\n throw new Error('Timezone is required unless input is a ZonedDateTime');\n }\n\n if (typeof input === 'string') {\n return Temporal.Instant.from(input).toZonedDateTimeISO(timezone).toPlainDate();\n }\n\n if (input instanceof Date) {\n return Temporal.Instant.from(input.toISOString()).toZonedDateTimeISO(timezone).toPlainDate();\n }\n\n if (input instanceof Temporal.Instant) {\n return input.toZonedDateTimeISO(timezone).toPlainDate();\n }\n\n return input.toInstant().toZonedDateTimeISO(timezone).toPlainDate();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAkClB,SAAS,YACd,OACA,UACoB;AACpB,MAAI,iBAAiB,SAAS,iBAAiB,aAAa,QAAW;AACrE,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,MAAI,aAAa,QAAW;AAC1B,UAAM,IAAI,MAAM,sDAAsD;AAAA,EACxE;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,SAAS,QAAQ,KAAK,KAAK,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EAC/E;AAEA,MAAI,iBAAiB,MAAM;AACzB,WAAO,SAAS,QAAQ,KAAK,MAAM,YAAY,CAAC,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EAC7F;AAEA,MAAI,iBAAiB,SAAS,SAAS;AACrC,WAAO,MAAM,mBAAmB,QAAQ,EAAE,YAAY;AAAA,EACxD;AAEA,SAAO,MAAM,UAAU,EAAE,mBAAmB,QAAQ,EAAE,YAAY;AACpE;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/endOfYear.ts"],"sourcesContent":["import type { Temporal } from '@js-temporal/polyfill';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns a ZonedDateTime representing the last moment of the year (last day at 23:59:59.999999999).\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at the last day of the year at 23:59:59.999999999\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');\n * const end = endOfYear(instant);\n * // 2025-12-31T23:59:59.999999999Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-06-15T15:30:00-05:00[America/New_York]');\n * const end = endOfYear(zoned);\n * // 2025-12-31T23:59:59.999999999-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // Need a different timezone? Convert first\n * const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');\n * const nyTime = instant.toZonedDateTimeISO('America/New_York');\n * const end = endOfYear(nyTime);\n * // 2025-12-31T23:59:59.999999999-05:00[America/New_York]\n * ```\n */\nexport function endOfYear(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime {\n const zonedDateTime = normalizeTemporalInput(input);\n\n // Get the number of months in this year\n const monthsInYear = zonedDateTime.monthsInYear;\n\n // Set to last month, then get last day of that month\n const lastMonth = zonedDateTime.with({ month: monthsInYear });\n const lastDay = lastMonth.with({ day: lastMonth.daysInMonth });\n\n return getEndOfDay(lastDay);\n}\n"],"mappings":";;;;;;;;AAmCO,SAAS,UACd,OACwB;AACxB,QAAM,gBAAgB,uBAAuB,KAAK;AAGlD,QAAM,eAAe,cAAc;AAGnC,QAAM,YAAY,cAAc,KAAK,EAAE,OAAO,aAAa,CAAC;AAC5D,QAAM,UAAU,UAAU,KAAK,EAAE,KAAK,UAAU,YAAY,CAAC;AAE7D,SAAO,YAAY,OAAO;AAC5B;","names":[]}
|
package/dist/chunk-XVJJR7H6.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getEndOfDay
|
|
3
|
-
} from "./chunk-AVGNRINZ.js";
|
|
4
|
-
import {
|
|
5
|
-
normalizeTemporalInput
|
|
6
|
-
} from "./chunk-MJSZNWCV.js";
|
|
7
|
-
|
|
8
|
-
// src/endOfWeek.ts
|
|
9
|
-
function endOfWeek(input) {
|
|
10
|
-
const zonedDateTime = normalizeTemporalInput(input);
|
|
11
|
-
const dayOfWeek = zonedDateTime.dayOfWeek;
|
|
12
|
-
const daysToAdd = 7 - dayOfWeek;
|
|
13
|
-
const sunday = zonedDateTime.add({ days: daysToAdd });
|
|
14
|
-
return getEndOfDay(sunday);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
endOfWeek
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=chunk-XVJJR7H6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/endOfWeek.ts"],"sourcesContent":["import type { Temporal } from '@js-temporal/polyfill';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns a ZonedDateTime representing the last moment of the week (Sunday at 23:59:59.999999999).\n * Uses ISO 8601 week definition: weeks end on Sunday.\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at Sunday 23:59:59.999999999\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z'); // Monday\n * const end = endOfWeek(instant);\n * // 2025-01-26T23:59:59.999999999Z[UTC] (next Sunday)\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-01-22T15:30:00-05:00[America/New_York]'); // Wednesday\n * const end = endOfWeek(zoned);\n * // 2025-01-26T23:59:59.999999999-05:00[America/New_York] (next Sunday)\n * ```\n *\n * @example\n * ```ts\n * // Need a different timezone? Convert first\n * const instant = Temporal.Instant.from('2025-01-22T12:00:00Z');\n * const nyTime = instant.toZonedDateTimeISO('America/New_York');\n * const end = endOfWeek(nyTime);\n * // 2025-01-26T23:59:59.999999999-05:00[America/New_York]\n * ```\n */\nexport function endOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime {\n const zonedDateTime = normalizeTemporalInput(input);\n\n // Get the day of week (1 = Monday, 7 = Sunday in ISO 8601)\n const dayOfWeek = zonedDateTime.dayOfWeek;\n\n // Calculate days to add to get to Sunday\n const daysToAdd = 7 - dayOfWeek;\n\n // Go to Sunday, then get end of that day\n const sunday = zonedDateTime.add({ days: daysToAdd });\n\n return getEndOfDay(sunday);\n}\n"],"mappings":";;;;;;;;AAoCO,SAAS,UACd,OACwB;AACxB,QAAM,gBAAgB,uBAAuB,KAAK;AAGlD,QAAM,YAAY,cAAc;AAGhC,QAAM,YAAY,IAAI;AAGtB,QAAM,SAAS,cAAc,IAAI,EAAE,MAAM,UAAU,CAAC;AAEpD,SAAO,YAAY,MAAM;AAC3B;","names":[]}
|
package/dist/chunk-YR2UCUIT.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeTemporalInput
|
|
3
|
-
} from "./chunk-MJSZNWCV.js";
|
|
4
|
-
|
|
5
|
-
// src/startOfYear.ts
|
|
6
|
-
function startOfYear(input) {
|
|
7
|
-
const zonedDateTime = normalizeTemporalInput(input);
|
|
8
|
-
const firstDay = zonedDateTime.with({ month: 1, day: 1 });
|
|
9
|
-
return firstDay.startOfDay();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
startOfYear
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=chunk-YR2UCUIT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/startOfYear.ts"],"sourcesContent":["import type { Temporal } from '@js-temporal/polyfill';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\n\n/**\n * Returns a ZonedDateTime representing the first moment of the year (January 1 at midnight).\n *\n * @param input - A Temporal.Instant (UTC) or Temporal.ZonedDateTime\n * @returns ZonedDateTime at January 1st at 00:00:00.000000000\n *\n * @example\n * ```ts\n * // From Instant (always UTC)\n * const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');\n * const start = startOfYear(instant);\n * // 2025-01-01T00:00:00Z[UTC]\n * ```\n *\n * @example\n * ```ts\n * // From ZonedDateTime (uses its timezone)\n * const zoned = Temporal.ZonedDateTime.from('2025-06-15T15:30:00-05:00[America/New_York]');\n * const start = startOfYear(zoned);\n * // 2025-01-01T00:00:00-05:00[America/New_York]\n * ```\n *\n * @example\n * ```ts\n * // Need a different timezone? Convert first\n * const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');\n * const nyTime = instant.toZonedDateTimeISO('America/New_York');\n * const start = startOfYear(nyTime);\n * // 2025-01-01T00:00:00-05:00[America/New_York]\n * ```\n */\nexport function startOfYear(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime {\n const zonedDateTime = normalizeTemporalInput(input);\n\n // Set to January 1st, then get start of that day\n const firstDay = zonedDateTime.with({ month: 1, day: 1 });\n\n return firstDay.startOfDay();\n}\n"],"mappings":";;;;;AAkCO,SAAS,YACd,OACwB;AACxB,QAAM,gBAAgB,uBAAuB,KAAK;AAGlD,QAAM,WAAW,cAAc,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,CAAC;AAExD,SAAO,SAAS,WAAW;AAC7B;","names":[]}
|