@gobrand/tiempo 2.5.3 → 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.
- 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-ID52RFFD.js +19 -0
- package/dist/chunk-ID52RFFD.js.map +1 -0
- package/dist/chunk-JNA3AFOC.js +13 -0
- package/dist/chunk-JNA3AFOC.js.map +1 -0
- package/dist/chunk-PWISCOZV.js +23 -0
- package/dist/chunk-PWISCOZV.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.js +9 -8
- 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/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-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-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
|
@@ -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
|
-
|
|
10
|
-
|
|
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-
|
|
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,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":[]}
|
package/dist/endOfDay.d.ts
CHANGED
|
@@ -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
|
-
* //
|
|
27
|
-
* const
|
|
28
|
-
* const
|
|
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
|
package/dist/endOfDay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endOfDay.d.ts","sourceRoot":"","sources":["../src/endOfDay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
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
package/dist/endOfMonth.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 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
|
-
* //
|
|
27
|
-
* const
|
|
28
|
-
* const
|
|
29
|
-
*
|
|
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
|
package/dist/endOfMonth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endOfMonth.d.ts","sourceRoot":"","sources":["../src/endOfMonth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
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"}
|
package/dist/endOfMonth.js
CHANGED
package/dist/endOfWeek.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 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
|
-
* //
|
|
28
|
-
* const
|
|
29
|
-
* const
|
|
30
|
-
*
|
|
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
|
package/dist/endOfWeek.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endOfWeek.d.ts","sourceRoot":"","sources":["../src/endOfWeek.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
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
package/dist/endOfYear.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 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
|
-
* //
|
|
27
|
-
* const
|
|
28
|
-
* const
|
|
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
|
package/dist/endOfYear.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endOfYear.d.ts","sourceRoot":"","sources":["../src/endOfYear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
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
package/dist/index.js
CHANGED
|
@@ -60,16 +60,16 @@ import {
|
|
|
60
60
|
} from "./chunk-TFSZ55L7.js";
|
|
61
61
|
import {
|
|
62
62
|
startOfDay
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-GFWC7CHD.js";
|
|
64
64
|
import {
|
|
65
65
|
startOfMonth
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-7GEIOKVQ.js";
|
|
67
67
|
import {
|
|
68
68
|
startOfWeek
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-EZ7NVTZI.js";
|
|
70
70
|
import {
|
|
71
71
|
startOfYear
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-ID52RFFD.js";
|
|
73
73
|
import {
|
|
74
74
|
subDays
|
|
75
75
|
} from "./chunk-YKBP3G7L.js";
|
|
@@ -123,7 +123,7 @@ import {
|
|
|
123
123
|
} from "./chunk-RW3C2677.js";
|
|
124
124
|
import {
|
|
125
125
|
endOfYear
|
|
126
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-GLGAVKGV.js";
|
|
127
127
|
import {
|
|
128
128
|
format
|
|
129
129
|
} from "./chunk-ZC6KWXCW.js";
|
|
@@ -159,14 +159,15 @@ import {
|
|
|
159
159
|
} from "./chunk-CHW2EN2O.js";
|
|
160
160
|
import {
|
|
161
161
|
endOfDay
|
|
162
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-XPJFOBPW.js";
|
|
163
163
|
import {
|
|
164
164
|
endOfMonth
|
|
165
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-PWISCOZV.js";
|
|
166
166
|
import {
|
|
167
167
|
endOfWeek
|
|
168
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-X26WIJ6L.js";
|
|
169
169
|
import "./chunk-AVGNRINZ.js";
|
|
170
|
+
import "./chunk-JNA3AFOC.js";
|
|
170
171
|
import {
|
|
171
172
|
addWeeks
|
|
172
173
|
} from "./chunk-DT2EWLHU.js";
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/startOfDay.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 day (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 = 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
|
package/dist/startOfDay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startOfDay.d.ts","sourceRoot":"","sources":["../src/startOfDay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
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"}
|
package/dist/startOfDay.js
CHANGED
package/dist/startOfMonth.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 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
|
-
* //
|
|
27
|
-
* const
|
|
28
|
-
* const
|
|
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,
|
|
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"}
|
package/dist/startOfMonth.js
CHANGED
package/dist/startOfWeek.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 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
|
-
* //
|
|
28
|
-
* const
|
|
29
|
-
* const
|
|
30
|
-
*
|
|
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,
|
|
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/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-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":[]}
|
|
@@ -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":[]}
|