courthive-components 3.4.0 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IANA-timezone-aware day boundary helpers.
|
|
3
|
+
*
|
|
4
|
+
* A TODS date string like `"2026-06-12"` means "the calendar day June 12 in
|
|
5
|
+
* the tournament's local time zone". When the calling code needs to compare
|
|
6
|
+
* `now` (a UTC instant) against that day's start or end, the comparison must
|
|
7
|
+
* happen in the tournament's zone — otherwise a tournament in `America/
|
|
8
|
+
* New_York` whose endDate is "2026-06-12" appears to end at 8pm local on the
|
|
9
|
+
* 11th (midnight UTC of the 12th), four hours before the day even starts in
|
|
10
|
+
* the venue.
|
|
11
|
+
*
|
|
12
|
+
* These helpers compute UTC `Date` instants corresponding to start-of-day
|
|
13
|
+
* for a given calendar date in a given IANA timezone. When `timeZone` is
|
|
14
|
+
* omitted they fall back to the host machine's local timezone — which is the
|
|
15
|
+
* right default for TMX (a TD's laptop is the source of truth for their own
|
|
16
|
+
* local clock).
|
|
17
|
+
*/
|
|
18
|
+
interface CalendarDate {
|
|
19
|
+
year: number;
|
|
20
|
+
/** 1-indexed month (1 = January). */
|
|
21
|
+
month: number;
|
|
22
|
+
day: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parses a `YYYY-MM-DD` (or full ISO) string into its calendar parts. Returns
|
|
26
|
+
* null when the input is missing or unparseable.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseCalendarDate(input?: string | null): CalendarDate | null;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a Date representing `00:00:00` on the given calendar day in the
|
|
31
|
+
* named IANA timezone. When `timeZone` is omitted, uses the host's local
|
|
32
|
+
* timezone (matching `new Date(year, month-1, day)` semantics).
|
|
33
|
+
*
|
|
34
|
+
* Uses a two-pass refinement on `Intl.DateTimeFormat.formatToParts` so DST
|
|
35
|
+
* boundaries resolve correctly: the first pass measures the offset at an
|
|
36
|
+
* estimated UTC instant; the second pass re-measures at the corrected
|
|
37
|
+
* instant in case the first guess fell on the wrong side of a transition.
|
|
38
|
+
*/
|
|
39
|
+
export declare function startOfDayInZone(date: CalendarDate, timeZone?: string): Date;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the exclusive end-of-day boundary for the given calendar day —
|
|
42
|
+
* i.e. the start of the next calendar day in the target zone. Useful for
|
|
43
|
+
* "now is past the end of this day" comparisons where the day is inclusive.
|
|
44
|
+
*/
|
|
45
|
+
export declare function startOfNextDayInZone(date: CalendarDate, timeZone?: string): Date;
|
|
46
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "courthive-components",
|
|
3
|
-
"packageManager": "pnpm@11.
|
|
4
|
-
"version": "3.4.
|
|
3
|
+
"packageManager": "pnpm@11.7.0",
|
|
4
|
+
"version": "3.4.3",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
7
7
|
},
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"@storybook/test-runner": "^0.24.0",
|
|
79
79
|
"@types/d3": "^7.4.3",
|
|
80
80
|
"@types/vanillajs-datepicker": "^1.3.5",
|
|
81
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
82
|
-
"@typescript-eslint/parser": "8.
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "8.61.0",
|
|
82
|
+
"@typescript-eslint/parser": "8.61.0",
|
|
83
83
|
"@vitest/browser-playwright": "^4.0.16",
|
|
84
84
|
"@vitest/coverage-v8": "^4.0.16",
|
|
85
85
|
"@vitest/ui": "^4.0.16",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"lint-staged": "17.0.7",
|
|
94
94
|
"playwright": "^1.57.0",
|
|
95
95
|
"prettier": "^3.8.1",
|
|
96
|
-
"semver": "7.8.
|
|
96
|
+
"semver": "7.8.4",
|
|
97
97
|
"storybook": "^10.2.17",
|
|
98
98
|
"tabulator-tables": "6.4.0",
|
|
99
99
|
"typescript": "^6.0.2",
|