@dereekb/date 13.0.7 → 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/index.cjs.js +3526 -993
  2. package/index.esm.js +3515 -983
  3. package/package.json +5 -6
  4. package/src/lib/date/date.calendar.d.ts +63 -9
  5. package/src/lib/date/date.cell.d.ts +203 -104
  6. package/src/lib/date/date.cell.factory.d.ts +319 -86
  7. package/src/lib/date/date.cell.filter.d.ts +104 -2
  8. package/src/lib/date/date.cell.index.d.ts +202 -92
  9. package/src/lib/date/date.cell.schedule.d.ts +285 -102
  10. package/src/lib/date/date.cell.schedule.day.d.ts +13 -3
  11. package/src/lib/date/date.cell.validator.d.ts +6 -8
  12. package/src/lib/date/date.cell.week.d.ts +24 -3
  13. package/src/lib/date/date.d.ts +481 -54
  14. package/src/lib/date/date.day.d.ts +139 -49
  15. package/src/lib/date/date.duration.d.ts +49 -11
  16. package/src/lib/date/date.format.d.ts +355 -36
  17. package/src/lib/date/date.hashset.d.ts +11 -0
  18. package/src/lib/date/date.logical.d.ts +61 -3
  19. package/src/lib/date/date.range.d.ts +355 -77
  20. package/src/lib/date/date.range.string.d.ts +39 -0
  21. package/src/lib/date/date.range.timezone.d.ts +18 -6
  22. package/src/lib/date/date.round.d.ts +46 -1
  23. package/src/lib/date/date.rxjs.d.ts +29 -7
  24. package/src/lib/date/date.sort.d.ts +36 -9
  25. package/src/lib/date/date.time.d.ts +197 -26
  26. package/src/lib/date/date.time.limit.d.ts +67 -4
  27. package/src/lib/date/date.time.minute.d.ts +269 -30
  28. package/src/lib/date/date.timezone.d.ts +286 -70
  29. package/src/lib/date/date.unix.d.ts +3 -0
  30. package/src/lib/date/date.week.d.ts +115 -51
  31. package/src/lib/query/query.builder.d.ts +91 -0
  32. package/src/lib/query/query.builder.mongo.d.ts +50 -0
  33. package/src/lib/query/query.filter.d.ts +29 -2
  34. package/src/lib/query/query.request.d.ts +16 -0
  35. package/src/lib/rrule/date.recurrence.d.ts +66 -22
  36. package/src/lib/rrule/date.rrule.d.ts +131 -8
  37. package/src/lib/rrule/date.rrule.extension.d.ts +50 -9
  38. package/src/lib/rrule/date.rrule.parse.d.ts +85 -2
  39. package/src/lib/timezone/timezone.d.ts +102 -2
  40. package/src/lib/timezone/timezone.validator.d.ts +9 -4
@@ -1,22 +1,122 @@
1
1
  import { type Maybe, type TimezoneAbbreviation, type TimezoneString, type TimezoneStringRef, type UTCTimezoneAbbreviation } from '@dereekb/util';
2
+ /**
3
+ * Returns all recognized IANA timezone strings, including the explicit UTC entry.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const zones = allTimezoneStrings();
8
+ * // ['Africa/Abidjan', ..., 'UTC']
9
+ * ```
10
+ */
2
11
  export declare function allTimezoneStrings(): TimezoneString[];
12
+ /**
13
+ * Lazily-computed set of all known timezone strings for O(1) membership checks.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * allKnownTimezoneStrings().has('America/New_York'); // true
18
+ * ```
19
+ */
3
20
  export declare const allKnownTimezoneStrings: import("@dereekb/util").CachedFactoryWithInput<Set<string>, unknown>;
21
+ /**
22
+ * Lazily-computed array of {@link TimezoneInfo} for every known timezone.
23
+ *
24
+ * Abbreviations are resolved at the time of first access, so results reflect
25
+ * the DST state at that moment.
26
+ */
4
27
  export declare const allTimezoneInfos: import("@dereekb/util").CachedFactoryWithInput<TimezoneInfo[], unknown>;
28
+ /**
29
+ * Pre-computed timezone metadata used for display and search operations.
30
+ *
31
+ * Contains lowercase and search-friendly string variants so that
32
+ * {@link searchTimezoneInfos} can perform fast case-insensitive matching.
33
+ */
5
34
  export interface TimezoneInfo extends TimezoneStringRef {
35
+ /** Searchable form with slashes/underscores replaced by spaces and lowercased. */
6
36
  readonly search: string;
37
+ /** Lowercased IANA timezone identifier. */
7
38
  readonly lowercase: string;
39
+ /** Short abbreviation (e.g., `"EST"`, `"PDT"`). */
8
40
  readonly abbreviation: string;
41
+ /** Lowercased abbreviation for case-insensitive matching. */
9
42
  readonly lowercaseAbbreviation: string;
10
43
  }
44
+ /**
45
+ * Returns the {@link TimezoneInfo} for the current system timezone, falling back to UTC.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const info = timezoneInfoForSystem();
50
+ * console.log(info.abbreviation); // e.g., 'CST'
51
+ * ```
52
+ */
11
53
  export declare function timezoneInfoForSystem(): TimezoneInfo;
54
+ /**
55
+ * Returns the short abbreviation (e.g., `"EST"`, `"PDT"`) for the given timezone at the specified date.
56
+ *
57
+ * The date matters because abbreviations change with DST transitions.
58
+ * Returns `"UKNOWN"` if no timezone is provided.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * getTimezoneAbbreviation('America/New_York'); // 'EST' or 'EDT'
63
+ * ```
64
+ */
12
65
  export declare function getTimezoneAbbreviation(timezone: Maybe<TimezoneString | UTCTimezoneAbbreviation>, date?: Date): TimezoneAbbreviation;
66
+ /**
67
+ * Returns the full display name (e.g., `"Eastern Standard Time"`) for the given timezone.
68
+ *
69
+ * Returns `"Unknown Timezone"` if no timezone is provided.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * getTimezoneLongName('America/New_York'); // 'Eastern Standard Time'
74
+ * ```
75
+ */
13
76
  export declare function getTimezoneLongName(timezone: Maybe<TimezoneString>, date?: Date): string;
77
+ /**
78
+ * Builds a {@link TimezoneInfo} for the given timezone, computing abbreviation and search variants.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const info = timezoneStringToTimezoneInfo('America/Chicago');
83
+ * // info.abbreviation => 'CST' or 'CDT'
84
+ * // info.search => 'america chicago'
85
+ * ```
86
+ */
14
87
  export declare function timezoneStringToTimezoneInfo(timezone: TimezoneString, date?: Date): TimezoneInfo;
88
+ /**
89
+ * Filters timezone infos by a search string, matching against the searchable name,
90
+ * lowercase identifier, and abbreviation.
91
+ *
92
+ * For queries longer than 2 characters, substring matching on the searchable name is also used.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const results = searchTimezoneInfos('eastern', allTimezoneInfos());
97
+ * ```
98
+ */
15
99
  export declare function searchTimezoneInfos(search: string, infos: TimezoneInfo[]): TimezoneInfo[];
100
+ /**
101
+ * Converts a timezone identifier into a lowercase, space-separated string for search indexing.
102
+ *
103
+ * Replaces `/` and `_` with spaces (e.g., `"America/New_York"` becomes `"america new york"`).
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * timezoneStringToSearchableString('America/New_York'); // 'america new york'
108
+ * ```
109
+ */
16
110
  export declare function timezoneStringToSearchableString(timezone: TimezoneString): string;
17
111
  /**
18
- * Returns true if the input string is a known timezone.
112
+ * Checks whether the input string is a recognized IANA timezone identifier.
113
+ *
114
+ * Uses the cached set from {@link allKnownTimezoneStrings} for O(1) lookup.
19
115
  *
20
- * @param input
116
+ * @example
117
+ * ```ts
118
+ * isKnownTimezone('America/New_York'); // true
119
+ * isKnownTimezone('Mars/Olympus'); // false
120
+ * ```
21
121
  */
22
122
  export declare function isKnownTimezone(input: string | TimezoneString): boolean;
@@ -1,6 +1,11 @@
1
- import { type ObjectWithConstructor } from '@dereekb/util';
2
- import { type ValidationOptions } from 'class-validator';
3
1
  /**
4
- * isKnownTimezone validator
2
+ * ArkType schema that validates a string is a recognized IANA timezone.
3
+ *
4
+ * Delegates to {@link isKnownTimezone} for the actual check.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const result = knownTimezoneType('America/Denver');
9
+ * ```
5
10
  */
6
- export declare function IsKnownTimezone(validationOptions?: ValidationOptions): (object: ObjectWithConstructor, propertyName: string) => void;
11
+ export declare const knownTimezoneType: import("arktype/internal/variants/string.ts").StringType<string, {}>;