@gobrand/tiempo 2.5.2 → 2.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/chunk-7GEIOKVQ.js +19 -0
  2. package/dist/chunk-7GEIOKVQ.js.map +1 -0
  3. package/dist/chunk-EZ7NVTZI.js +21 -0
  4. package/dist/chunk-EZ7NVTZI.js.map +1 -0
  5. package/dist/chunk-GFWC7CHD.js +21 -0
  6. package/dist/chunk-GFWC7CHD.js.map +1 -0
  7. package/dist/{chunk-XDVUGTUV.js → chunk-GLGAVKGV.js} +7 -3
  8. package/dist/chunk-GLGAVKGV.js.map +1 -0
  9. package/dist/chunk-ID52RFFD.js +19 -0
  10. package/dist/chunk-ID52RFFD.js.map +1 -0
  11. package/dist/chunk-JNA3AFOC.js +13 -0
  12. package/dist/chunk-JNA3AFOC.js.map +1 -0
  13. package/dist/chunk-PWISCOZV.js +23 -0
  14. package/dist/chunk-PWISCOZV.js.map +1 -0
  15. package/dist/chunk-UCCWUJ2K.js +25 -0
  16. package/dist/chunk-UCCWUJ2K.js.map +1 -0
  17. package/dist/chunk-X26WIJ6L.js +24 -0
  18. package/dist/chunk-X26WIJ6L.js.map +1 -0
  19. package/dist/chunk-XPJFOBPW.js +24 -0
  20. package/dist/chunk-XPJFOBPW.js.map +1 -0
  21. package/dist/endOfDay.d.ts +5 -4
  22. package/dist/endOfDay.d.ts.map +1 -1
  23. package/dist/endOfDay.js +2 -1
  24. package/dist/endOfMonth.d.ts +7 -6
  25. package/dist/endOfMonth.d.ts.map +1 -1
  26. package/dist/endOfMonth.js +2 -1
  27. package/dist/endOfWeek.d.ts +7 -6
  28. package/dist/endOfWeek.d.ts.map +1 -1
  29. package/dist/endOfWeek.js +2 -1
  30. package/dist/endOfYear.d.ts +6 -5
  31. package/dist/endOfYear.d.ts.map +1 -1
  32. package/dist/endOfYear.js +2 -1
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +16 -11
  36. package/dist/shared/plainDateToZonedDateTime.d.ts +9 -0
  37. package/dist/shared/plainDateToZonedDateTime.d.ts.map +1 -0
  38. package/dist/shared/plainDateToZonedDateTime.js +7 -0
  39. package/dist/shared/plainDateToZonedDateTime.js.map +1 -0
  40. package/dist/startOfDay.d.ts +6 -5
  41. package/dist/startOfDay.d.ts.map +1 -1
  42. package/dist/startOfDay.js +2 -1
  43. package/dist/startOfMonth.d.ts +6 -5
  44. package/dist/startOfMonth.d.ts.map +1 -1
  45. package/dist/startOfMonth.js +2 -1
  46. package/dist/startOfWeek.d.ts +7 -6
  47. package/dist/startOfWeek.d.ts.map +1 -1
  48. package/dist/startOfWeek.js +2 -1
  49. package/dist/startOfYear.d.ts +6 -5
  50. package/dist/startOfYear.d.ts.map +1 -1
  51. package/dist/startOfYear.js +2 -1
  52. package/dist/toPlainDate.d.ts +31 -0
  53. package/dist/toPlainDate.d.ts.map +1 -0
  54. package/dist/toPlainDate.js +7 -0
  55. package/dist/toPlainDate.js.map +1 -0
  56. package/dist/toPlainDate.test.d.ts +2 -0
  57. package/dist/toPlainDate.test.d.ts.map +1 -0
  58. package/package.json +3 -2
  59. package/dist/chunk-2WMXB7QL.js +0 -17
  60. package/dist/chunk-2WMXB7QL.js.map +0 -1
  61. package/dist/chunk-CUMB4776.js +0 -18
  62. package/dist/chunk-CUMB4776.js.map +0 -1
  63. package/dist/chunk-GM6RNAYE.js +0 -19
  64. package/dist/chunk-GM6RNAYE.js.map +0 -1
  65. package/dist/chunk-TU2UNOOW.js +0 -15
  66. package/dist/chunk-TU2UNOOW.js.map +0 -1
  67. package/dist/chunk-TW5EV3DH.js +0 -14
  68. package/dist/chunk-TW5EV3DH.js.map +0 -1
  69. package/dist/chunk-XDVUGTUV.js.map +0 -1
  70. package/dist/chunk-XVJJR7H6.js +0 -20
  71. package/dist/chunk-XVJJR7H6.js.map +0 -1
  72. package/dist/chunk-YR2UCUIT.js +0 -15
  73. package/dist/chunk-YR2UCUIT.js.map +0 -1
@@ -0,0 +1,19 @@
1
+ import {
2
+ plainDateToZonedDateTime
3
+ } from "./chunk-JNA3AFOC.js";
4
+ import {
5
+ normalizeTemporalInput
6
+ } from "./chunk-MJSZNWCV.js";
7
+
8
+ // src/startOfMonth.ts
9
+ import { Temporal } from "@js-temporal/polyfill";
10
+ function startOfMonth(input, timezone) {
11
+ const zonedDateTime = input instanceof Temporal.PlainDate ? plainDateToZonedDateTime(input, timezone) : normalizeTemporalInput(input);
12
+ const firstDay = zonedDateTime.with({ day: 1 });
13
+ return firstDay.startOfDay();
14
+ }
15
+
16
+ export {
17
+ startOfMonth
18
+ };
19
+ //# sourceMappingURL=chunk-7GEIOKVQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/startOfMonth.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\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 * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-01-15');\n * const start = startOfMonth(date, 'America/New_York');\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;\nexport function startOfMonth(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function startOfMonth(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime {\n const zonedDateTime =\n input instanceof Temporal.PlainDate\n ? plainDateToZonedDateTime(input, timezone!)\n : 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":";;;;;;;;AAAA,SAAS,gBAAgB;AA0ClB,SAAS,aACd,OACA,UACwB;AACxB,QAAM,gBACJ,iBAAiB,SAAS,YACtB,yBAAyB,OAAO,QAAS,IACzC,uBAAuB,KAAK;AAGlC,QAAM,WAAW,cAAc,KAAK,EAAE,KAAK,EAAE,CAAC;AAE9C,SAAO,SAAS,WAAW;AAC7B;","names":[]}
@@ -0,0 +1,21 @@
1
+ import {
2
+ plainDateToZonedDateTime
3
+ } from "./chunk-JNA3AFOC.js";
4
+ import {
5
+ normalizeTemporalInput
6
+ } from "./chunk-MJSZNWCV.js";
7
+
8
+ // src/startOfWeek.ts
9
+ import { Temporal } from "@js-temporal/polyfill";
10
+ function startOfWeek(input, timezone) {
11
+ const zonedDateTime = input instanceof Temporal.PlainDate ? plainDateToZonedDateTime(input, timezone) : normalizeTemporalInput(input);
12
+ const dayOfWeek = zonedDateTime.dayOfWeek;
13
+ const daysToSubtract = dayOfWeek - 1;
14
+ const monday = zonedDateTime.subtract({ days: daysToSubtract });
15
+ return monday.startOfDay();
16
+ }
17
+
18
+ export {
19
+ startOfWeek
20
+ };
21
+ //# sourceMappingURL=chunk-EZ7NVTZI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/startOfWeek.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\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 * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-01-22'); // Wednesday\n * const start = startOfWeek(date, 'America/New_York');\n * // 2025-01-20T00:00:00-05:00[America/New_York] (previous Monday)\n * ```\n */\nexport function startOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime;\nexport function startOfWeek(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function startOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime {\n const zonedDateTime =\n input instanceof Temporal.PlainDate\n ? plainDateToZonedDateTime(input, timezone!)\n : 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":";;;;;;;;AAAA,SAAS,gBAAgB;AA2ClB,SAAS,YACd,OACA,UACwB;AACxB,QAAM,gBACJ,iBAAiB,SAAS,YACtB,yBAAyB,OAAO,QAAS,IACzC,uBAAuB,KAAK;AAGlC,QAAM,YAAY,cAAc;AAGhC,QAAM,iBAAiB,YAAY;AAGnC,QAAM,SAAS,cAAc,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9D,SAAO,OAAO,WAAW;AAC3B;","names":[]}
@@ -0,0 +1,21 @@
1
+ import {
2
+ plainDateToZonedDateTime
3
+ } from "./chunk-JNA3AFOC.js";
4
+ import {
5
+ normalizeTemporalInput
6
+ } from "./chunk-MJSZNWCV.js";
7
+
8
+ // src/startOfDay.ts
9
+ import { Temporal } from "@js-temporal/polyfill";
10
+ function startOfDay(input, timezone) {
11
+ if (input instanceof Temporal.PlainDate) {
12
+ return plainDateToZonedDateTime(input, timezone).startOfDay();
13
+ }
14
+ const zonedDateTime = normalizeTemporalInput(input);
15
+ return zonedDateTime.startOfDay();
16
+ }
17
+
18
+ export {
19
+ startOfDay
20
+ };
21
+ //# sourceMappingURL=chunk-GFWC7CHD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/startOfDay.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\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 * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-01-20');\n * const start = startOfDay(date, 'America/New_York');\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;\nexport function startOfDay(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function startOfDay(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime {\n if (input instanceof Temporal.PlainDate) {\n return plainDateToZonedDateTime(input, timezone!).startOfDay();\n }\n\n const zonedDateTime = normalizeTemporalInput(input);\n return zonedDateTime.startOfDay();\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,gBAAgB;AA0ClB,SAAS,WACd,OACA,UACwB;AACxB,MAAI,iBAAiB,SAAS,WAAW;AACvC,WAAO,yBAAyB,OAAO,QAAS,EAAE,WAAW;AAAA,EAC/D;AAEA,QAAM,gBAAgB,uBAAuB,KAAK;AAClD,SAAO,cAAc,WAAW;AAClC;","names":[]}
@@ -1,13 +1,17 @@
1
1
  import {
2
2
  getEndOfDay
3
3
  } from "./chunk-AVGNRINZ.js";
4
+ import {
5
+ plainDateToZonedDateTime
6
+ } from "./chunk-JNA3AFOC.js";
4
7
  import {
5
8
  normalizeTemporalInput
6
9
  } from "./chunk-MJSZNWCV.js";
7
10
 
8
11
  // src/endOfYear.ts
9
- function endOfYear(input) {
10
- const zonedDateTime = normalizeTemporalInput(input);
12
+ import { Temporal } from "@js-temporal/polyfill";
13
+ function endOfYear(input, timezone) {
14
+ const zonedDateTime = input instanceof Temporal.PlainDate ? plainDateToZonedDateTime(input, timezone) : normalizeTemporalInput(input);
11
15
  const monthsInYear = zonedDateTime.monthsInYear;
12
16
  const lastMonth = zonedDateTime.with({ month: monthsInYear });
13
17
  const lastDay = lastMonth.with({ day: lastMonth.daysInMonth });
@@ -17,4 +21,4 @@ function endOfYear(input) {
17
21
  export {
18
22
  endOfYear
19
23
  };
20
- //# sourceMappingURL=chunk-XDVUGTUV.js.map
24
+ //# sourceMappingURL=chunk-GLGAVKGV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/endOfYear.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\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 * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-06-15');\n * const end = endOfYear(date, 'America/New_York');\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;\nexport function endOfYear(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function endOfYear(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime {\n const zonedDateTime =\n input instanceof Temporal.PlainDate\n ? plainDateToZonedDateTime(input, timezone!)\n : 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":";;;;;;;;;;;AAAA,SAAS,gBAAgB;AA2ClB,SAAS,UACd,OACA,UACwB;AACxB,QAAM,gBACJ,iBAAiB,SAAS,YACtB,yBAAyB,OAAO,QAAS,IACzC,uBAAuB,KAAK;AAGlC,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":[]}
@@ -0,0 +1,19 @@
1
+ import {
2
+ plainDateToZonedDateTime
3
+ } from "./chunk-JNA3AFOC.js";
4
+ import {
5
+ normalizeTemporalInput
6
+ } from "./chunk-MJSZNWCV.js";
7
+
8
+ // src/startOfYear.ts
9
+ import { Temporal } from "@js-temporal/polyfill";
10
+ function startOfYear(input, timezone) {
11
+ const zonedDateTime = input instanceof Temporal.PlainDate ? plainDateToZonedDateTime(input, timezone) : normalizeTemporalInput(input);
12
+ const firstDay = zonedDateTime.with({ month: 1, day: 1 });
13
+ return firstDay.startOfDay();
14
+ }
15
+
16
+ export {
17
+ startOfYear
18
+ };
19
+ //# sourceMappingURL=chunk-ID52RFFD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/startOfYear.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\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 * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-06-15');\n * const start = startOfYear(date, 'America/New_York');\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;\nexport function startOfYear(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function startOfYear(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime {\n const zonedDateTime =\n input instanceof Temporal.PlainDate\n ? plainDateToZonedDateTime(input, timezone!)\n : 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":";;;;;;;;AAAA,SAAS,gBAAgB;AA0ClB,SAAS,YACd,OACA,UACwB;AACxB,QAAM,gBACJ,iBAAiB,SAAS,YACtB,yBAAyB,OAAO,QAAS,IACzC,uBAAuB,KAAK;AAGlC,QAAM,WAAW,cAAc,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,CAAC;AAExD,SAAO,SAAS,WAAW;AAC7B;","names":[]}
@@ -0,0 +1,13 @@
1
+ // src/shared/plainDateToZonedDateTime.ts
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ function plainDateToZonedDateTime(date, timezone) {
4
+ return date.toZonedDateTime({
5
+ timeZone: timezone,
6
+ plainTime: Temporal.PlainTime.from("00:00")
7
+ });
8
+ }
9
+
10
+ export {
11
+ plainDateToZonedDateTime
12
+ };
13
+ //# sourceMappingURL=chunk-JNA3AFOC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shared/plainDateToZonedDateTime.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from '../types';\n\n/**\n * @internal\n * Converts a PlainDate to a ZonedDateTime at midnight in the specified timezone.\n * This is an internal helper - do not use directly.\n */\nexport function plainDateToZonedDateTime(\n date: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime {\n return date.toZonedDateTime({\n timeZone: timezone,\n plainTime: Temporal.PlainTime.from('00:00'),\n });\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAQlB,SAAS,yBACd,MACA,UACwB;AACxB,SAAO,KAAK,gBAAgB;AAAA,IAC1B,UAAU;AAAA,IACV,WAAW,SAAS,UAAU,KAAK,OAAO;AAAA,EAC5C,CAAC;AACH;","names":[]}
@@ -0,0 +1,23 @@
1
+ import {
2
+ getEndOfDay
3
+ } from "./chunk-AVGNRINZ.js";
4
+ import {
5
+ plainDateToZonedDateTime
6
+ } from "./chunk-JNA3AFOC.js";
7
+ import {
8
+ normalizeTemporalInput
9
+ } from "./chunk-MJSZNWCV.js";
10
+
11
+ // src/endOfMonth.ts
12
+ import { Temporal } from "@js-temporal/polyfill";
13
+ function endOfMonth(input, timezone) {
14
+ const zonedDateTime = input instanceof Temporal.PlainDate ? plainDateToZonedDateTime(input, timezone) : normalizeTemporalInput(input);
15
+ const daysInMonth = zonedDateTime.daysInMonth;
16
+ const lastDay = zonedDateTime.with({ day: daysInMonth });
17
+ return getEndOfDay(lastDay);
18
+ }
19
+
20
+ export {
21
+ endOfMonth
22
+ };
23
+ //# sourceMappingURL=chunk-PWISCOZV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/endOfMonth.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\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 * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-02-15');\n * const end = endOfMonth(date, 'America/New_York');\n * // 2025-02-28T23:59:59.999999999-05:00[America/New_York]\n * ```\n */\nexport function endOfMonth(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime;\nexport function endOfMonth(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function endOfMonth(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime {\n const zonedDateTime =\n input instanceof Temporal.PlainDate\n ? plainDateToZonedDateTime(input, timezone!)\n : 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":";;;;;;;;;;;AAAA,SAAS,gBAAgB;AA2ClB,SAAS,WACd,OACA,UACwB;AACxB,QAAM,gBACJ,iBAAiB,SAAS,YACtB,yBAAyB,OAAO,QAAS,IACzC,uBAAuB,KAAK;AAGlC,QAAM,cAAc,cAAc;AAGlC,QAAM,UAAU,cAAc,KAAK,EAAE,KAAK,YAAY,CAAC;AAEvD,SAAO,YAAY,OAAO;AAC5B;","names":[]}
@@ -0,0 +1,25 @@
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
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,24 @@
1
+ import {
2
+ getEndOfDay
3
+ } from "./chunk-AVGNRINZ.js";
4
+ import {
5
+ plainDateToZonedDateTime
6
+ } from "./chunk-JNA3AFOC.js";
7
+ import {
8
+ normalizeTemporalInput
9
+ } from "./chunk-MJSZNWCV.js";
10
+
11
+ // src/endOfWeek.ts
12
+ import { Temporal } from "@js-temporal/polyfill";
13
+ function endOfWeek(input, timezone) {
14
+ const zonedDateTime = input instanceof Temporal.PlainDate ? plainDateToZonedDateTime(input, timezone) : normalizeTemporalInput(input);
15
+ const dayOfWeek = zonedDateTime.dayOfWeek;
16
+ const daysToAdd = 7 - dayOfWeek;
17
+ const sunday = zonedDateTime.add({ days: daysToAdd });
18
+ return getEndOfDay(sunday);
19
+ }
20
+
21
+ export {
22
+ endOfWeek
23
+ };
24
+ //# sourceMappingURL=chunk-X26WIJ6L.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/endOfWeek.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\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 * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-01-22'); // Wednesday\n * const end = endOfWeek(date, 'America/New_York');\n * // 2025-01-26T23:59:59.999999999-05:00[America/New_York] (next Sunday)\n * ```\n */\nexport function endOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime\n): Temporal.ZonedDateTime;\nexport function endOfWeek(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function endOfWeek(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime {\n const zonedDateTime =\n input instanceof Temporal.PlainDate\n ? plainDateToZonedDateTime(input, timezone!)\n : 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":";;;;;;;;;;;AAAA,SAAS,gBAAgB;AA4ClB,SAAS,UACd,OACA,UACwB;AACxB,QAAM,gBACJ,iBAAiB,SAAS,YACtB,yBAAyB,OAAO,QAAS,IACzC,uBAAuB,KAAK;AAGlC,QAAM,YAAY,cAAc;AAGhC,QAAM,YAAY,IAAI;AAGtB,QAAM,SAAS,cAAc,IAAI,EAAE,MAAM,UAAU,CAAC;AAEpD,SAAO,YAAY,MAAM;AAC3B;","names":[]}
@@ -0,0 +1,24 @@
1
+ import {
2
+ getEndOfDay
3
+ } from "./chunk-AVGNRINZ.js";
4
+ import {
5
+ plainDateToZonedDateTime
6
+ } from "./chunk-JNA3AFOC.js";
7
+ import {
8
+ normalizeTemporalInput
9
+ } from "./chunk-MJSZNWCV.js";
10
+
11
+ // src/endOfDay.ts
12
+ import { Temporal } from "@js-temporal/polyfill";
13
+ function endOfDay(input, timezone) {
14
+ if (input instanceof Temporal.PlainDate) {
15
+ return getEndOfDay(plainDateToZonedDateTime(input, timezone));
16
+ }
17
+ const zonedDateTime = normalizeTemporalInput(input);
18
+ return getEndOfDay(zonedDateTime);
19
+ }
20
+
21
+ export {
22
+ endOfDay
23
+ };
24
+ //# sourceMappingURL=chunk-XPJFOBPW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/endOfDay.ts"],"sourcesContent":["import { Temporal } from '@js-temporal/polyfill';\nimport type { Timezone } from './types';\nimport { getEndOfDay } from './shared/endOfDay';\nimport { normalizeTemporalInput } from './shared/normalizeTemporalInput';\nimport { plainDateToZonedDateTime } from './shared/plainDateToZonedDateTime';\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 * // From PlainDate (requires timezone)\n * const date = Temporal.PlainDate.from('2025-01-20');\n * const end = endOfDay(date, 'America/New_York');\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;\nexport function endOfDay(\n input: Temporal.PlainDate,\n timezone: Timezone\n): Temporal.ZonedDateTime;\nexport function endOfDay(\n input: Temporal.Instant | Temporal.ZonedDateTime | Temporal.PlainDate,\n timezone?: Timezone\n): Temporal.ZonedDateTime {\n if (input instanceof Temporal.PlainDate) {\n return getEndOfDay(plainDateToZonedDateTime(input, timezone!));\n }\n\n const zonedDateTime = normalizeTemporalInput(input);\n return getEndOfDay(zonedDateTime);\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,gBAAgB;AA2ClB,SAAS,SACd,OACA,UACwB;AACxB,MAAI,iBAAiB,SAAS,WAAW;AACvC,WAAO,YAAY,yBAAyB,OAAO,QAAS,CAAC;AAAA,EAC/D;AAEA,QAAM,gBAAgB,uBAAuB,KAAK;AAClD,SAAO,YAAY,aAAa;AAClC;","names":[]}
@@ -1,4 +1,5 @@
1
1
  import { Temporal } from '@js-temporal/polyfill';
2
+ import type { Timezone } from './types';
2
3
  /**
3
4
  * Returns a ZonedDateTime representing the last nanosecond of the day.
4
5
  *
@@ -23,12 +24,12 @@ import { Temporal } from '@js-temporal/polyfill';
23
24
  *
24
25
  * @example
25
26
  * ```ts
26
- * // Need a different timezone? Convert first
27
- * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');
28
- * const nyTime = instant.toZonedDateTimeISO('America/New_York');
29
- * const end = endOfDay(nyTime);
27
+ * // From PlainDate (requires timezone)
28
+ * const date = Temporal.PlainDate.from('2025-01-20');
29
+ * const end = endOfDay(date, 'America/New_York');
30
30
  * // 2025-01-20T23:59:59.999999999-05:00[America/New_York]
31
31
  * ```
32
32
  */
33
33
  export declare function endOfDay(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
34
+ export declare function endOfDay(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
34
35
  //# sourceMappingURL=endOfDay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"endOfDay.d.ts","sourceRoot":"","sources":["../src/endOfDay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAIxB"}
1
+ {"version":3,"file":"endOfDay.d.ts","sourceRoot":"","sources":["../src/endOfDay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,QAAQ,CACtB,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,aAAa,CAAC"}
package/dist/endOfDay.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  endOfDay
3
- } from "./chunk-CUMB4776.js";
3
+ } from "./chunk-XPJFOBPW.js";
4
4
  import "./chunk-AVGNRINZ.js";
5
+ import "./chunk-JNA3AFOC.js";
5
6
  import "./chunk-MJSZNWCV.js";
6
7
  export {
7
8
  endOfDay
@@ -1,4 +1,5 @@
1
- import type { Temporal } from '@js-temporal/polyfill';
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ import type { Timezone } from './types';
2
3
  /**
3
4
  * Returns a ZonedDateTime representing the last moment of the month (last day at 23:59:59.999999999).
4
5
  *
@@ -23,12 +24,12 @@ import type { Temporal } from '@js-temporal/polyfill';
23
24
  *
24
25
  * @example
25
26
  * ```ts
26
- * // Need a different timezone? Convert first
27
- * const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');
28
- * const nyTime = instant.toZonedDateTimeISO('America/New_York');
29
- * const end = endOfMonth(nyTime);
30
- * // 2025-01-31T23:59:59.999999999-05:00[America/New_York]
27
+ * // From PlainDate (requires timezone)
28
+ * const date = Temporal.PlainDate.from('2025-02-15');
29
+ * const end = endOfMonth(date, 'America/New_York');
30
+ * // 2025-02-28T23:59:59.999999999-05:00[America/New_York]
31
31
  * ```
32
32
  */
33
33
  export declare function endOfMonth(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
34
+ export declare function endOfMonth(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
34
35
  //# sourceMappingURL=endOfMonth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"endOfMonth.d.ts","sourceRoot":"","sources":["../src/endOfMonth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAUxB"}
1
+ {"version":3,"file":"endOfMonth.d.ts","sourceRoot":"","sources":["../src/endOfMonth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,aAAa,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  endOfMonth
3
- } from "./chunk-GM6RNAYE.js";
3
+ } from "./chunk-PWISCOZV.js";
4
4
  import "./chunk-AVGNRINZ.js";
5
+ import "./chunk-JNA3AFOC.js";
5
6
  import "./chunk-MJSZNWCV.js";
6
7
  export {
7
8
  endOfMonth
@@ -1,4 +1,5 @@
1
- import type { Temporal } from '@js-temporal/polyfill';
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ import type { Timezone } from './types';
2
3
  /**
3
4
  * Returns a ZonedDateTime representing the last moment of the week (Sunday at 23:59:59.999999999).
4
5
  * Uses ISO 8601 week definition: weeks end on Sunday.
@@ -24,12 +25,12 @@ import type { Temporal } from '@js-temporal/polyfill';
24
25
  *
25
26
  * @example
26
27
  * ```ts
27
- * // Need a different timezone? Convert first
28
- * const instant = Temporal.Instant.from('2025-01-22T12:00:00Z');
29
- * const nyTime = instant.toZonedDateTimeISO('America/New_York');
30
- * const end = endOfWeek(nyTime);
31
- * // 2025-01-26T23:59:59.999999999-05:00[America/New_York]
28
+ * // From PlainDate (requires timezone)
29
+ * const date = Temporal.PlainDate.from('2025-01-22'); // Wednesday
30
+ * const end = endOfWeek(date, 'America/New_York');
31
+ * // 2025-01-26T23:59:59.999999999-05:00[America/New_York] (next Sunday)
32
32
  * ```
33
33
  */
34
34
  export declare function endOfWeek(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
35
+ export declare function endOfWeek(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
35
36
  //# sourceMappingURL=endOfWeek.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"endOfWeek.d.ts","sourceRoot":"","sources":["../src/endOfWeek.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAaxB"}
1
+ {"version":3,"file":"endOfWeek.d.ts","sourceRoot":"","sources":["../src/endOfWeek.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,aAAa,CAAC"}
package/dist/endOfWeek.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  endOfWeek
3
- } from "./chunk-XVJJR7H6.js";
3
+ } from "./chunk-X26WIJ6L.js";
4
4
  import "./chunk-AVGNRINZ.js";
5
+ import "./chunk-JNA3AFOC.js";
5
6
  import "./chunk-MJSZNWCV.js";
6
7
  export {
7
8
  endOfWeek
@@ -1,4 +1,5 @@
1
- import type { Temporal } from '@js-temporal/polyfill';
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ import type { Timezone } from './types';
2
3
  /**
3
4
  * Returns a ZonedDateTime representing the last moment of the year (last day at 23:59:59.999999999).
4
5
  *
@@ -23,12 +24,12 @@ import type { Temporal } from '@js-temporal/polyfill';
23
24
  *
24
25
  * @example
25
26
  * ```ts
26
- * // Need a different timezone? Convert first
27
- * const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');
28
- * const nyTime = instant.toZonedDateTimeISO('America/New_York');
29
- * const end = endOfYear(nyTime);
27
+ * // From PlainDate (requires timezone)
28
+ * const date = Temporal.PlainDate.from('2025-06-15');
29
+ * const end = endOfYear(date, 'America/New_York');
30
30
  * // 2025-12-31T23:59:59.999999999-05:00[America/New_York]
31
31
  * ```
32
32
  */
33
33
  export declare function endOfYear(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
34
+ export declare function endOfYear(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
34
35
  //# sourceMappingURL=endOfYear.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"endOfYear.d.ts","sourceRoot":"","sources":["../src/endOfYear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAWxB"}
1
+ {"version":3,"file":"endOfYear.d.ts","sourceRoot":"","sources":["../src/endOfYear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,SAAS,CACvB,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,aAAa,CAAC"}
package/dist/endOfYear.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  endOfYear
3
- } from "./chunk-XDVUGTUV.js";
3
+ } from "./chunk-GLGAVKGV.js";
4
4
  import "./chunk-AVGNRINZ.js";
5
+ import "./chunk-JNA3AFOC.js";
5
6
  import "./chunk-MJSZNWCV.js";
6
7
  export {
7
8
  endOfYear
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { toZonedTime } from './toZonedTime';
2
2
  export { toPlainTime } from './toPlainTime';
3
+ export { toPlainDate } from './toPlainDate';
3
4
  export type { Timezone, IANATimezone } from './types';
4
5
  export { browserTimezone } from './browserTimezone';
5
6
  export { toUtc } from './toUtc';
@@ -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,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;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AAO,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;AACxD,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ import {
2
+ toZonedTime
3
+ } from "./chunk-MXQFENCR.js";
1
4
  import {
2
5
  today
3
6
  } from "./chunk-KZB6NERH.js";
@@ -13,15 +16,15 @@ import {
13
16
  import {
14
17
  toIso9075
15
18
  } from "./chunk-DFLGGK4F.js";
19
+ import {
20
+ toPlainDate
21
+ } from "./chunk-UCCWUJ2K.js";
16
22
  import {
17
23
  toPlainTime
18
24
  } from "./chunk-G45S5B4O.js";
19
25
  import {
20
26
  toUtc
21
27
  } from "./chunk-BW5SFCKS.js";
22
- import {
23
- toZonedTime
24
- } from "./chunk-MXQFENCR.js";
25
28
  import {
26
29
  subHours
27
30
  } from "./chunk-XW5MLXX5.js";
@@ -57,16 +60,16 @@ import {
57
60
  } from "./chunk-TFSZ55L7.js";
58
61
  import {
59
62
  startOfDay
60
- } from "./chunk-TW5EV3DH.js";
63
+ } from "./chunk-GFWC7CHD.js";
61
64
  import {
62
65
  startOfMonth
63
- } from "./chunk-TU2UNOOW.js";
66
+ } from "./chunk-7GEIOKVQ.js";
64
67
  import {
65
68
  startOfWeek
66
- } from "./chunk-2WMXB7QL.js";
69
+ } from "./chunk-EZ7NVTZI.js";
67
70
  import {
68
71
  startOfYear
69
- } from "./chunk-YR2UCUIT.js";
72
+ } from "./chunk-ID52RFFD.js";
70
73
  import {
71
74
  subDays
72
75
  } from "./chunk-YKBP3G7L.js";
@@ -120,7 +123,7 @@ import {
120
123
  } from "./chunk-RW3C2677.js";
121
124
  import {
122
125
  endOfYear
123
- } from "./chunk-XDVUGTUV.js";
126
+ } from "./chunk-GLGAVKGV.js";
124
127
  import {
125
128
  format
126
129
  } from "./chunk-ZC6KWXCW.js";
@@ -156,14 +159,15 @@ import {
156
159
  } from "./chunk-CHW2EN2O.js";
157
160
  import {
158
161
  endOfDay
159
- } from "./chunk-CUMB4776.js";
162
+ } from "./chunk-XPJFOBPW.js";
160
163
  import {
161
164
  endOfMonth
162
- } from "./chunk-GM6RNAYE.js";
165
+ } from "./chunk-PWISCOZV.js";
163
166
  import {
164
167
  endOfWeek
165
- } from "./chunk-XVJJR7H6.js";
168
+ } from "./chunk-X26WIJ6L.js";
166
169
  import "./chunk-AVGNRINZ.js";
170
+ import "./chunk-JNA3AFOC.js";
167
171
  import {
168
172
  addWeeks
169
173
  } from "./chunk-DT2EWLHU.js";
@@ -281,6 +285,7 @@ export {
281
285
  toDate,
282
286
  toIso,
283
287
  toIso9075,
288
+ toPlainDate,
284
289
  toPlainTime,
285
290
  toUtc,
286
291
  toZonedTime,
@@ -0,0 +1,9 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ import type { Timezone } from '../types';
3
+ /**
4
+ * @internal
5
+ * Converts a PlainDate to a ZonedDateTime at midnight in the specified timezone.
6
+ * This is an internal helper - do not use directly.
7
+ */
8
+ export declare function plainDateToZonedDateTime(date: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
9
+ //# sourceMappingURL=plainDateToZonedDateTime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plainDateToZonedDateTime.d.ts","sourceRoot":"","sources":["../../src/shared/plainDateToZonedDateTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,QAAQ,CAAC,SAAS,EACxB,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,aAAa,CAKxB"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ plainDateToZonedDateTime
3
+ } from "../chunk-JNA3AFOC.js";
4
+ export {
5
+ plainDateToZonedDateTime
6
+ };
7
+ //# sourceMappingURL=plainDateToZonedDateTime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,5 @@
1
- import type { Temporal } from '@js-temporal/polyfill';
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 day (midnight).
4
5
  *
@@ -23,12 +24,12 @@ import type { Temporal } from '@js-temporal/polyfill';
23
24
  *
24
25
  * @example
25
26
  * ```ts
26
- * // Need a different timezone? Convert first
27
- * const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');
28
- * const nyTime = instant.toZonedDateTimeISO('America/New_York');
29
- * const start = startOfDay(nyTime);
27
+ * // From PlainDate (requires timezone)
28
+ * const date = Temporal.PlainDate.from('2025-01-20');
29
+ * const start = startOfDay(date, 'America/New_York');
30
30
  * // 2025-01-20T00:00:00-05:00[America/New_York]
31
31
  * ```
32
32
  */
33
33
  export declare function startOfDay(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
34
+ export declare function startOfDay(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
34
35
  //# sourceMappingURL=startOfDay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"startOfDay.d.ts","sourceRoot":"","sources":["../src/startOfDay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAIxB"}
1
+ {"version":3,"file":"startOfDay.d.ts","sourceRoot":"","sources":["../src/startOfDay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,aAAa,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  startOfDay
3
- } from "./chunk-TW5EV3DH.js";
3
+ } from "./chunk-GFWC7CHD.js";
4
+ import "./chunk-JNA3AFOC.js";
4
5
  import "./chunk-MJSZNWCV.js";
5
6
  export {
6
7
  startOfDay
@@ -1,4 +1,5 @@
1
- import type { Temporal } from '@js-temporal/polyfill';
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 month (day 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
- * // Need a different timezone? Convert first
27
- * const instant = Temporal.Instant.from('2025-01-15T12:00:00Z');
28
- * const nyTime = instant.toZonedDateTimeISO('America/New_York');
29
- * const start = startOfMonth(nyTime);
27
+ * // From PlainDate (requires timezone)
28
+ * const date = Temporal.PlainDate.from('2025-01-15');
29
+ * const start = startOfMonth(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 startOfMonth(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
34
+ export declare function startOfMonth(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
34
35
  //# sourceMappingURL=startOfMonth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"startOfMonth.d.ts","sourceRoot":"","sources":["../src/startOfMonth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAOxB"}
1
+ {"version":3,"file":"startOfMonth.d.ts","sourceRoot":"","sources":["../src/startOfMonth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAAC;AAC1B,wBAAgB,YAAY,CAC1B,KAAK,EAAE,QAAQ,CAAC,SAAS,EACzB,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,aAAa,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  startOfMonth
3
- } from "./chunk-TU2UNOOW.js";
3
+ } from "./chunk-7GEIOKVQ.js";
4
+ import "./chunk-JNA3AFOC.js";
4
5
  import "./chunk-MJSZNWCV.js";
5
6
  export {
6
7
  startOfMonth
@@ -1,4 +1,5 @@
1
- import type { Temporal } from '@js-temporal/polyfill';
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 week (Monday at midnight).
4
5
  * Uses ISO 8601 week definition: weeks start on Monday.
@@ -24,12 +25,12 @@ import type { Temporal } from '@js-temporal/polyfill';
24
25
  *
25
26
  * @example
26
27
  * ```ts
27
- * // Need a different timezone? Convert first
28
- * const instant = Temporal.Instant.from('2025-01-22T12:00:00Z');
29
- * const nyTime = instant.toZonedDateTimeISO('America/New_York');
30
- * const start = startOfWeek(nyTime);
31
- * // 2025-01-20T00:00:00-05:00[America/New_York]
28
+ * // From PlainDate (requires timezone)
29
+ * const date = Temporal.PlainDate.from('2025-01-22'); // Wednesday
30
+ * const start = startOfWeek(date, 'America/New_York');
31
+ * // 2025-01-20T00:00:00-05:00[America/New_York] (previous Monday)
32
32
  * ```
33
33
  */
34
34
  export declare function startOfWeek(input: Temporal.Instant | Temporal.ZonedDateTime): Temporal.ZonedDateTime;
35
+ export declare function startOfWeek(input: Temporal.PlainDate, timezone: Timezone): Temporal.ZonedDateTime;
35
36
  //# sourceMappingURL=startOfWeek.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"startOfWeek.d.ts","sourceRoot":"","sources":["../src/startOfWeek.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAaxB"}
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"}
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  startOfWeek
3
- } from "./chunk-2WMXB7QL.js";
3
+ } from "./chunk-EZ7NVTZI.js";
4
+ import "./chunk-JNA3AFOC.js";
4
5
  import "./chunk-MJSZNWCV.js";
5
6
  export {
6
7
  startOfWeek
@@ -1,4 +1,5 @@
1
- import type { Temporal } from '@js-temporal/polyfill';
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
- * // Need a different timezone? Convert first
27
- * const instant = Temporal.Instant.from('2025-06-15T12:00:00Z');
28
- * const nyTime = instant.toZonedDateTimeISO('America/New_York');
29
- * const 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,uBAAuB,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,GAC/C,QAAQ,CAAC,aAAa,CAOxB"}
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"}
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  startOfYear
3
- } from "./chunk-YR2UCUIT.js";
3
+ } from "./chunk-ID52RFFD.js";
4
+ import "./chunk-JNA3AFOC.js";
4
5
  import "./chunk-MJSZNWCV.js";
5
6
  export {
6
7
  startOfYear
@@ -0,0 +1,31 @@
1
+ import { Temporal } from '@js-temporal/polyfill';
2
+ import type { Timezone } from './types';
3
+ /**
4
+ * Extract the calendar date from a ZonedDateTime or convert an input to a timezone and extract the date.
5
+ *
6
+ * @param input - A Temporal.ZonedDateTime (timezone optional) or a UTC ISO string, Date, Instant, or ZonedDateTime (timezone required)
7
+ * @param timezone - IANA timezone identifier. Required unless input is a ZonedDateTime.
8
+ * @returns A Temporal.PlainDate representing the calendar date
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { toPlainDate, toZonedTime } from '@gobrand/tiempo';
13
+ *
14
+ * // From ZonedDateTime (no timezone needed)
15
+ * const zdt = toZonedTime("2025-01-20T15:30:00Z", "America/New_York");
16
+ * const date = toPlainDate(zdt); // 2025-01-20
17
+ *
18
+ * // From UTC string with timezone
19
+ * const date2 = toPlainDate("2025-01-20T15:30:00Z", "America/New_York"); // 2025-01-20
20
+ *
21
+ * // From Date with timezone
22
+ * const jsDate = new Date("2025-01-20T15:30:00.000Z");
23
+ * const date3 = toPlainDate(jsDate, "Europe/London"); // 2025-01-20
24
+ *
25
+ * // Date boundary crossing: 23:00 UTC on Jan 20 → Jan 21 in Tokyo
26
+ * const date4 = toPlainDate("2025-01-20T23:00:00Z", "Asia/Tokyo"); // 2025-01-21
27
+ * ```
28
+ */
29
+ export declare function toPlainDate(input: Temporal.ZonedDateTime): Temporal.PlainDate;
30
+ export declare function toPlainDate(input: string | Date | Temporal.Instant | Temporal.ZonedDateTime, timezone: Timezone): Temporal.PlainDate;
31
+ //# sourceMappingURL=toPlainDate.d.ts.map
@@ -0,0 +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;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;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"}
@@ -0,0 +1,7 @@
1
+ import {
2
+ toPlainDate
3
+ } from "./chunk-UCCWUJ2K.js";
4
+ export {
5
+ toPlainDate
6
+ };
7
+ //# sourceMappingURL=toPlainDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=toPlainDate.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toPlainDate.test.d.ts","sourceRoot":"","sources":["../src/toPlainDate.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobrand/tiempo",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "description": "Lightweight utility functions for converting between UTC and timezone-aware datetimes using the Temporal API",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -31,7 +31,8 @@
31
31
  "homepage": "https://eng.gobrand.app/tiempo",
32
32
  "scripts": {
33
33
  "generate:timezones": "tsx scripts/generate-timezone-types.ts",
34
- "build": "pnpm generate:timezones && tsup && tsc --emitDeclarationOnly",
34
+ "generate:docs": "tsx scripts/generate-docs.ts",
35
+ "build": "pnpm generate:timezones && pnpm generate:docs && tsup && tsc --emitDeclarationOnly",
35
36
  "clean": "git clean -xdf .cache .turbo dist node_modules tsconfig.tsbuildinfo",
36
37
  "test": "vitest",
37
38
  "typecheck": "tsc --noEmit",
@@ -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":[]}
@@ -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":[]}
@@ -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":[]}
@@ -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":[]}
@@ -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":[]}
@@ -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":[]}
@@ -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":[]}
@@ -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":[]}