@dereekb/date 13.3.1 → 13.4.1
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/index.cjs.js +987 -356
- package/index.esm.js +983 -357
- package/package.json +5 -4
- package/src/lib/date/date.calendar.d.ts +3 -3
- package/src/lib/date/date.cell.d.ts +5 -0
- package/src/lib/date/date.cell.factory.d.ts +77 -0
- package/src/lib/date/date.cell.filter.d.ts +7 -0
- package/src/lib/date/date.cell.index.d.ts +44 -4
- package/src/lib/date/date.cell.schedule.d.ts +2 -0
- package/src/lib/date/date.d.ts +6 -0
- package/src/lib/date/date.day.d.ts +22 -3
- package/src/lib/date/date.format.d.ts +70 -8
- package/src/lib/date/date.range.d.ts +105 -2
- package/src/lib/date/date.range.timezone.d.ts +1 -0
- package/src/lib/date/date.time.d.ts +12 -0
- package/src/lib/date/date.time.limit.d.ts +9 -0
- package/src/lib/date/date.time.minute.d.ts +28 -0
- package/src/lib/date/date.timezone.d.ts +107 -15
- package/src/lib/date/date.week.d.ts +9 -4
- package/src/lib/date/index.d.ts +0 -1
- package/src/lib/query/query.builder.mongo.d.ts +9 -3
- package/src/lib/rrule/date.recurrence.d.ts +21 -7
- package/src/lib/rrule/date.rrule.d.ts +2 -0
- package/src/lib/rrule/date.rrule.extension.d.ts +10 -0
- package/src/lib/rrule/date.rrule.parse.d.ts +41 -0
- package/src/lib/timezone/index.d.ts +0 -1
- package/src/lib/timezone/timezone.d.ts +38 -4
|
@@ -2,6 +2,8 @@ import { type Maybe, type TimezoneAbbreviation, type TimezoneString, type Timezo
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns all recognized IANA timezone strings, including the explicit UTC entry.
|
|
4
4
|
*
|
|
5
|
+
* @returns all known IANA timezone strings plus UTC
|
|
6
|
+
*
|
|
5
7
|
* @example
|
|
6
8
|
* ```ts
|
|
7
9
|
* const zones = allTimezoneStrings();
|
|
@@ -32,18 +34,28 @@ export declare const allTimezoneInfos: import("@dereekb/util").CachedFactoryWith
|
|
|
32
34
|
* {@link searchTimezoneInfos} can perform fast case-insensitive matching.
|
|
33
35
|
*/
|
|
34
36
|
export interface TimezoneInfo extends TimezoneStringRef {
|
|
35
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Searchable form with slashes/underscores replaced by spaces and lowercased.
|
|
39
|
+
*/
|
|
36
40
|
readonly search: string;
|
|
37
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Lowercased IANA timezone identifier.
|
|
43
|
+
*/
|
|
38
44
|
readonly lowercase: string;
|
|
39
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Short abbreviation (e.g., `"EST"`, `"PDT"`).
|
|
47
|
+
*/
|
|
40
48
|
readonly abbreviation: string;
|
|
41
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Lowercased abbreviation for case-insensitive matching.
|
|
51
|
+
*/
|
|
42
52
|
readonly lowercaseAbbreviation: string;
|
|
43
53
|
}
|
|
44
54
|
/**
|
|
45
55
|
* Returns the {@link TimezoneInfo} for the current system timezone, falling back to UTC.
|
|
46
56
|
*
|
|
57
|
+
* @returns timezone info for the current system timezone
|
|
58
|
+
*
|
|
47
59
|
* @example
|
|
48
60
|
* ```ts
|
|
49
61
|
* const info = timezoneInfoForSystem();
|
|
@@ -57,6 +69,10 @@ export declare function timezoneInfoForSystem(): TimezoneInfo;
|
|
|
57
69
|
* The date matters because abbreviations change with DST transitions.
|
|
58
70
|
* Returns `"UKNOWN"` if no timezone is provided.
|
|
59
71
|
*
|
|
72
|
+
* @param timezone - the IANA timezone string (or UTC abbreviation) to get the abbreviation for
|
|
73
|
+
* @param date - the date at which to evaluate the abbreviation (defaults to now)
|
|
74
|
+
* @returns the short timezone abbreviation
|
|
75
|
+
*
|
|
60
76
|
* @example
|
|
61
77
|
* ```ts
|
|
62
78
|
* getTimezoneAbbreviation('America/New_York'); // 'EST' or 'EDT'
|
|
@@ -68,6 +84,10 @@ export declare function getTimezoneAbbreviation(timezone: Maybe<TimezoneString |
|
|
|
68
84
|
*
|
|
69
85
|
* Returns `"Unknown Timezone"` if no timezone is provided.
|
|
70
86
|
*
|
|
87
|
+
* @param timezone - the IANA timezone string to get the long name for
|
|
88
|
+
* @param date - the date at which to evaluate the name (defaults to now)
|
|
89
|
+
* @returns the full timezone display name
|
|
90
|
+
*
|
|
71
91
|
* @example
|
|
72
92
|
* ```ts
|
|
73
93
|
* getTimezoneLongName('America/New_York'); // 'Eastern Standard Time'
|
|
@@ -77,6 +97,10 @@ export declare function getTimezoneLongName(timezone: Maybe<TimezoneString>, dat
|
|
|
77
97
|
/**
|
|
78
98
|
* Builds a {@link TimezoneInfo} for the given timezone, computing abbreviation and search variants.
|
|
79
99
|
*
|
|
100
|
+
* @param timezone - the IANA timezone string to build info for
|
|
101
|
+
* @param date - the date at which to evaluate the abbreviation (defaults to now)
|
|
102
|
+
* @returns the computed TimezoneInfo
|
|
103
|
+
*
|
|
80
104
|
* @example
|
|
81
105
|
* ```ts
|
|
82
106
|
* const info = timezoneStringToTimezoneInfo('America/Chicago');
|
|
@@ -91,6 +115,10 @@ export declare function timezoneStringToTimezoneInfo(timezone: TimezoneString, d
|
|
|
91
115
|
*
|
|
92
116
|
* For queries longer than 2 characters, substring matching on the searchable name is also used.
|
|
93
117
|
*
|
|
118
|
+
* @param search - the search query string
|
|
119
|
+
* @param infos - the array of TimezoneInfo objects to filter
|
|
120
|
+
* @returns the matching TimezoneInfo entries
|
|
121
|
+
*
|
|
94
122
|
* @example
|
|
95
123
|
* ```ts
|
|
96
124
|
* const results = searchTimezoneInfos('eastern', allTimezoneInfos());
|
|
@@ -102,6 +130,9 @@ export declare function searchTimezoneInfos(search: string, infos: TimezoneInfo[
|
|
|
102
130
|
*
|
|
103
131
|
* Replaces `/` and `_` with spaces (e.g., `"America/New_York"` becomes `"america new york"`).
|
|
104
132
|
*
|
|
133
|
+
* @param timezone - the IANA timezone string to convert
|
|
134
|
+
* @returns the searchable lowercase string
|
|
135
|
+
*
|
|
105
136
|
* @example
|
|
106
137
|
* ```ts
|
|
107
138
|
* timezoneStringToSearchableString('America/New_York'); // 'america new york'
|
|
@@ -113,6 +144,9 @@ export declare function timezoneStringToSearchableString(timezone: TimezoneStrin
|
|
|
113
144
|
*
|
|
114
145
|
* Uses the cached set from {@link allKnownTimezoneStrings} for O(1) lookup.
|
|
115
146
|
*
|
|
147
|
+
* @param input - the string to check
|
|
148
|
+
* @returns whether the input is a known timezone
|
|
149
|
+
*
|
|
116
150
|
* @example
|
|
117
151
|
* ```ts
|
|
118
152
|
* isKnownTimezone('America/New_York'); // true
|