@bereasoftware/time-guard 2.6.0 → 2.7.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 (98) hide show
  1. package/README.en.md +232 -0
  2. package/README.md +259 -4
  3. package/dist/{types/adapters → adapters}/temporal.adapter.d.ts +4 -9
  4. package/dist/angular/index.cjs +148 -0
  5. package/dist/angular/index.d.ts +2 -0
  6. package/dist/angular/index.es.js +143 -0
  7. package/dist/angular.d.ts +59 -0
  8. package/dist/calendars/index.cjs +357 -2
  9. package/dist/calendars/index.es.js +99 -68
  10. package/dist/chunk-Ddh6569R.cjs +36 -0
  11. package/dist/core-BAd7GYfw.js +1809 -0
  12. package/dist/core-CafqOI7W.cjs +1892 -0
  13. package/dist/core.d.ts +224 -0
  14. package/dist/index.d.ts +9 -0
  15. package/dist/locales/african.locale.d.ts +7 -0
  16. package/dist/locales/index.cjs +7 -2
  17. package/dist/{types/locales → locales}/index.d.ts +2 -2
  18. package/dist/locales/index.es.js +3 -2797
  19. package/dist/locales/south-american.locale.d.ts +7 -0
  20. package/dist/locales-C2-lOmC8.cjs +3537 -0
  21. package/dist/locales-CcuSu4P1.js +3514 -0
  22. package/dist/native/index.cjs +48 -0
  23. package/dist/native/index.d.ts +2 -0
  24. package/dist/native/index.es.js +18 -0
  25. package/dist/native.d.ts +9 -0
  26. package/dist/plugins/advanced-format.cjs +105 -2
  27. package/dist/plugins/advanced-format.es.js +63 -45
  28. package/dist/plugins/duration.cjs +258 -2
  29. package/dist/plugins/duration.es.js +165 -61
  30. package/dist/plugins/index.d.ts +10 -0
  31. package/dist/plugins/relative-time.cjs +166 -2
  32. package/dist/plugins/relative-time.es.js +74 -37
  33. package/dist/qwik/index.cjs +104 -0
  34. package/dist/qwik/index.d.ts +2 -0
  35. package/dist/qwik/index.es.js +100 -0
  36. package/dist/qwik.d.ts +32 -0
  37. package/dist/react/index.cjs +112 -0
  38. package/dist/react/index.d.ts +2 -0
  39. package/dist/react/index.es.js +103 -0
  40. package/dist/react.d.ts +46 -0
  41. package/dist/solid/index.cjs +127 -0
  42. package/dist/solid/index.d.ts +2 -0
  43. package/dist/solid/index.es.js +122 -0
  44. package/dist/solid.d.ts +53 -0
  45. package/dist/svelte/index.cjs +398 -0
  46. package/dist/svelte/index.d.ts +2 -0
  47. package/dist/svelte/index.es.js +393 -0
  48. package/dist/svelte.d.ts +88 -0
  49. package/dist/time-guard.cjs +7359 -4
  50. package/dist/time-guard.d.ts +2 -0
  51. package/dist/time-guard.es.js +3625 -8073
  52. package/dist/time-guard.iife.js +13549 -4
  53. package/dist/time-guard.umd.js +13550 -4
  54. package/dist/types/index.d.ts +651 -128
  55. package/dist/vue/index.cjs +143 -0
  56. package/dist/vue/index.d.ts +2 -0
  57. package/dist/vue/index.es.js +137 -0
  58. package/dist/vue.d.ts +35 -0
  59. package/package.json +111 -17
  60. package/dist/calendars/index.cjs.map +0 -1
  61. package/dist/calendars/index.es.js.map +0 -1
  62. package/dist/locales/index.cjs.map +0 -1
  63. package/dist/locales/index.es.js.map +0 -1
  64. package/dist/plugins/advanced-format.cjs.map +0 -1
  65. package/dist/plugins/advanced-format.es.js.map +0 -1
  66. package/dist/plugins/duration.cjs.map +0 -1
  67. package/dist/plugins/duration.es.js.map +0 -1
  68. package/dist/plugins/relative-time.cjs.map +0 -1
  69. package/dist/plugins/relative-time.es.js.map +0 -1
  70. package/dist/time-guard.cjs.map +0 -1
  71. package/dist/time-guard.es.js.map +0 -1
  72. package/dist/time-guard.iife.js.map +0 -1
  73. package/dist/time-guard.umd.js.map +0 -1
  74. package/dist/types/plugins/index.d.ts +0 -10
  75. package/dist/types/types/index.d.ts +0 -586
  76. /package/dist/{types/calendars → calendars}/calendar.manager.d.ts +0 -0
  77. /package/dist/{types/calendars → calendars}/index.d.ts +0 -0
  78. /package/dist/{types/formatters → formatters}/date.formatter.d.ts +0 -0
  79. /package/dist/{types/locales → locales}/additional.locale.d.ts +0 -0
  80. /package/dist/{types/locales → locales}/asian.locale.d.ts +0 -0
  81. /package/dist/{types/locales → locales}/english.locale.d.ts +0 -0
  82. /package/dist/{types/locales → locales}/european.locale.d.ts +0 -0
  83. /package/dist/{types/locales → locales}/locale.manager.d.ts +0 -0
  84. /package/dist/{types/locales → locales}/middle-eastern.locale.d.ts +0 -0
  85. /package/dist/{types/locales → locales}/nordic.locale.d.ts +0 -0
  86. /package/dist/{types/locales → locales}/romance.locale.d.ts +0 -0
  87. /package/dist/{types/locales → locales}/slavic.locale.d.ts +0 -0
  88. /package/dist/{types/locales → locales}/spanish.locale.d.ts +0 -0
  89. /package/dist/{types/plugins → plugins}/advanced-format/index.d.ts +0 -0
  90. /package/dist/{types/plugins → plugins}/advanced-format.d.ts +0 -0
  91. /package/dist/{types/plugins → plugins}/duration/index.d.ts +0 -0
  92. /package/dist/{types/plugins → plugins}/duration/types.d.ts +0 -0
  93. /package/dist/{types/plugins → plugins}/duration.d.ts +0 -0
  94. /package/dist/{types/plugins → plugins}/manager.d.ts +0 -0
  95. /package/dist/{types/plugins → plugins}/relative-time/index.d.ts +0 -0
  96. /package/dist/{types/plugins → plugins}/relative-time/types.d.ts +0 -0
  97. /package/dist/{types/plugins → plugins}/relative-time.d.ts +0 -0
  98. /package/dist/{types/utils → utils}/duration-locale.d.ts +0 -0
@@ -1,10 +0,0 @@
1
- /**
2
- * TimeGuard Plugins
3
- * Central export point for all plugins
4
- */
5
- export { PluginManager } from './manager';
6
- export { RelativeTimePlugin, default as relativeTimePlugin } from './relative-time';
7
- export { DurationPlugin, Duration, default as durationPlugin } from './duration';
8
- export { AdvancedFormatPlugin, default as advancedFormatPlugin } from './advanced-format';
9
- export type { RelativeTimeConfig, RelativeTimeFormats, RelativeTimeThreshold } from './relative-time/types';
10
- export type { IDuration, DurationInput, DurationObject, DurationUnit } from './duration/types';
@@ -1,586 +0,0 @@
1
- /**
2
- * TimeGuard - Core Types and Interfaces
3
- * Following SOLID principles and TypeScript best practices
4
- *
5
- * Temporal types are provided natively by TypeScript (lib.esnext.temporal).
6
- */
7
- /**
8
- * Unit type for date/time operations
9
- */
10
- export type Unit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond' | 'microsecond' | 'nanosecond';
11
- /**
12
- * Format preset strings for common patterns
13
- */
14
- export type FormatPreset = 'iso' | 'date' | 'time' | 'datetime' | 'rfc2822' | 'rfc3339' | 'utc';
15
- /**
16
- * Duration-like object for arithmetic operations
17
- */
18
- export interface IDuration {
19
- years?: number;
20
- months?: number;
21
- weeks?: number;
22
- days?: number;
23
- hours?: number;
24
- minutes?: number;
25
- seconds?: number;
26
- milliseconds?: number;
27
- microseconds?: number;
28
- nanoseconds?: number;
29
- }
30
- /**
31
- * Round options for precision control
32
- */
33
- export interface IRoundOptions {
34
- smallestUnit?: Unit;
35
- roundingMode?: 'ceil' | 'floor' | 'expand' | 'trunc' | 'halfExpand' | 'halfFloor' | 'halfCeil' | 'halfTrunc';
36
- roundingIncrement?: number;
37
- }
38
- /**
39
- * Duration options for normalizing time differences
40
- */
41
- export interface IDurationOptions {
42
- largestUnit?: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
43
- smallestUnit?: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
44
- }
45
- /**
46
- * Diff result object that allows chaining with .as()
47
- * Example: tg1.diff(tg2).as('month')
48
- */
49
- export interface IDiffResult {
50
- as(unit: Unit): number;
51
- /**
52
- * Get breakdown in calendar mode (e.g., "2 months 5 days")
53
- * Only available when mode is 'calendar'
54
- */
55
- breakdown(): DurationParts | null;
56
- /**
57
- * Format the difference as a human-readable string
58
- * @param locale Locale code (e.g., 'en', 'es', 'fr')
59
- * @example
60
- * diff.format('en') // "2 months and 5 days"
61
- * diff.format('es') // "2 meses y 5 días"
62
- */
63
- format(locale?: string): string;
64
- /**
65
- * Get the mode used for this diff calculation
66
- */
67
- getMode(): 'calendar' | 'exact';
68
- }
69
- /**
70
- * Options for diff() method
71
- */
72
- export interface IDiffOptions {
73
- /**
74
- * Calculation mode:
75
- * - 'calendar': Returns months/days breakdown (e.g., 65 days → 2 months 5 days)
76
- * - 'exact': Returns exact time units (e.g., 65 days)
77
- * @default 'exact'
78
- */
79
- mode?: 'calendar' | 'exact';
80
- /**
81
- * Unit for diff when using 'exact' mode
82
- * @default 'millisecond'
83
- */
84
- unit?: Unit;
85
- /**
86
- * Locale for formatting output text
87
- * @default from TimeGuard instance config
88
- */
89
- locale?: string;
90
- }
91
- /**
92
- * Duration parts breakdown
93
- */
94
- export interface DurationParts {
95
- years: number;
96
- months: number;
97
- weeks: number;
98
- days: number;
99
- hours: number;
100
- minutes: number;
101
- seconds: number;
102
- milliseconds: number;
103
- }
104
- /**
105
- * Base interface for formattable duration-like objects
106
- * Common functionality shared by DiffResult and DurationResult
107
- */
108
- export interface IFormattableDuration {
109
- toString(): string;
110
- toJSON(): Record<string, number> | number;
111
- }
112
- /**
113
- * Options for humanize() method
114
- */
115
- export interface IHumanizeOptions {
116
- /**
117
- * Locale code (e.g., 'en', 'es', 'fr')
118
- * @default from TimeGuard instance config
119
- */
120
- locale?: string;
121
- /**
122
- * Show full breakdown (e.g., "2 months and 5 days")
123
- * or just largest unit (e.g., "2 months")
124
- * @default false (largest unit only with Intl.RelativeTimeFormat style)
125
- */
126
- fullBreakdown?: boolean;
127
- /**
128
- * Numeric format: 'always', 'auto'
129
- * @default 'always'
130
- */
131
- numeric?: 'always' | 'auto';
132
- }
133
- /**
134
- * Duration result with humanize and total methods
135
- * Returned by until(), since(), and between()
136
- * Rich object for business logic: payments, metrics, analytics
137
- */
138
- export interface IDurationResult extends DurationParts {
139
- /**
140
- * Convert duration to human-readable string
141
- * @example
142
- * duration.humanize() // "2 months"
143
- * duration.humanize({ fullBreakdown: true, locale: 'es' }) // "2 meses y 5 días"
144
- */
145
- humanize(options?: IHumanizeOptions): string;
146
- /**
147
- * Get total duration in specified unit (date-fns style)
148
- * Perfect for business metrics: payments, analytics, calculations
149
- *
150
- * Conversion factors account for:
151
- * - Leap years (1 year = 365.25 days)
152
- * - Average month length (1 month = 30.4375 days)
153
- *
154
- * @example
155
- * duration.total('days') // 65
156
- * duration.total('months') // 2.166... (65 / 30.4375)
157
- * duration.total('hours') // 1560
158
- * duration.total('seconds') // 5616000
159
- *
160
- * Use cases:
161
- * - Billing calculations: `duration.total('days') * dailyRate`
162
- * - Performance metrics: `duration.total('milliseconds')`
163
- * - Report generation: `duration.total('months')`
164
- */
165
- total(unit: Unit): number;
166
- /**
167
- * String representation
168
- * Returns humanized format for display
169
- */
170
- toString(): string;
171
- /**
172
- * JSON representation
173
- * Returns breakdown as object for API responses
174
- */
175
- toJSON(): Record<string, number>;
176
- /**
177
- * Explain the calculation - killer feature for debugging and education
178
- * Returns detailed breakdown of how the duration was calculated
179
- *
180
- * Perfect for:
181
- * - Debugging complex date calculations
182
- * - Educational purposes (showing date math)
183
- * - Auditing time-based business logic
184
- *
185
- * @example
186
- * duration.explain()
187
- * // {
188
- * // input: ['2024-01-15', '2024-03-20'],
189
- * // steps: ['...step 1...', '...step 2...'],
190
- * // breakdown: { years: 0, months: 2, days: 5, ... },
191
- * // mode: 'exact',
192
- * // explanation: '...'
193
- * // }
194
- */
195
- explain(): IDurationExplanation;
196
- }
197
- /**
198
- * Duration explanation object for debugging and education
199
- * Provides transparent insight into calculation methodology
200
- * Perfect for: debugging, auditing, educational purposes
201
- *
202
- * @example
203
- * duration.explain()
204
- * // {
205
- * // input: ['2024-01-15', '2024-03-20'],
206
- * // steps: [
207
- * // 'Parsed dates: 2024-01-15 (day 15 of 365) to 2024-03-20 (day 80 of 365)',
208
- * // '2024 is a leap year (366 days)',
209
- * // 'February 2024 has 29 days',
210
- * // 'Month 1: 31 - 15 = 16 days remaining',
211
- * // 'Month 2: 29 days (full leap month)',
212
- * // 'Month 3: 1 - 20 = 20 days',
213
- * // 'Total: 16 + 29 + 20 = 65 days'
214
- * // ],
215
- * // breakdown: { years: 0, months: 2, weeks: 0, days: 5, ... },
216
- * // mode: 'exact',
217
- * // explanation: 'Calculated 2024-01-15 to 2024-03-20 including leap year adjustment'
218
- * // }
219
- */
220
- export interface IDurationExplanation {
221
- /**
222
- * Input dates as array of strings or formatted representations
223
- */
224
- input: string[];
225
- /**
226
- * Step-by-step calculation explanation
227
- * Each step is human-readable and educational
228
- * Useful for debugging complex date calculations
229
- */
230
- steps: string[];
231
- /**
232
- * Duration breakdown by component
233
- * Same as the DurationResult properties
234
- */
235
- breakdown: DurationParts;
236
- /**
237
- * Calculation mode
238
- * - 'exact': Uses Temporal API precise calculations
239
- * - 'estimated': Fallback for edge cases
240
- */
241
- mode: 'exact' | 'estimated';
242
- /**
243
- * Human-readable explanation of the entire calculation
244
- * Summarizes the approach and any special handling
245
- */
246
- explanation: string;
247
- /**
248
- * Locale used for explanation text
249
- * Supports internationalization of step descriptions
250
- */
251
- locale: string;
252
- /**
253
- * Leap year flags if applicable
254
- * Documents which years were leap years in the calculation
255
- */
256
- leapYearFlags?: {
257
- year: number;
258
- isLeap: boolean;
259
- daysInFebruary: number;
260
- }[];
261
- /**
262
- * Performance metadata
263
- * For monitoring calculation complexity
264
- */
265
- metadata?: {
266
- calculationTimeMs: number;
267
- precision: 'nanosecond' | 'microsecond' | 'millisecond' | 'second' | 'day';
268
- };
269
- }
270
- /**
271
- * Calendar system interface
272
- */
273
- export interface ICalendarSystem {
274
- id: string;
275
- name: string;
276
- locale?: string;
277
- getMonthName(month: number, short?: boolean): string;
278
- getWeekdayName(day: number, short?: boolean): string;
279
- isLeapYear(year: number): boolean;
280
- daysInMonth(year: number, month: number): number;
281
- daysInYear(year: number): number;
282
- }
283
- /**
284
- * Calendar manager interface
285
- */
286
- export interface ICalendarManager {
287
- register(calendar: ICalendarSystem): void;
288
- get(id: string): ICalendarSystem | undefined;
289
- list(): string[];
290
- setDefault(id: string): void;
291
- getDefault(): ICalendarSystem;
292
- }
293
- /**
294
- * Locale configuration interface
295
- */
296
- export interface ILocale {
297
- name: string;
298
- months: string[];
299
- monthsShort: string[];
300
- weekdays: string[];
301
- weekdaysShort: string[];
302
- weekdaysMin: string[];
303
- meridiem?: {
304
- am: string;
305
- pm: string;
306
- };
307
- formats?: Record<string, string>;
308
- }
309
- /**
310
- * Configuration options for TimeGuard instance
311
- */
312
- export interface ITimeGuardConfig {
313
- locale?: string;
314
- timezone?: string;
315
- strict?: boolean;
316
- }
317
- /**
318
- * Interface for date/time parsing strategy (Strategy Pattern)
319
- */
320
- export interface IDateParser {
321
- parse(input: unknown): any | null;
322
- canHandle(input: unknown): boolean;
323
- }
324
- /**
325
- * Interface for date/time formatting (Strategy Pattern)
326
- */
327
- export interface IDateFormatter {
328
- format(date: any, pattern: string): string;
329
- getPreset(preset: FormatPreset): string;
330
- }
331
- /**
332
- * Interface for locale management (Single Responsibility)
333
- */
334
- export interface ILocaleManager {
335
- setLocale(locale: string, data?: ILocale): void;
336
- getLocale(locale?: string): ILocale;
337
- listLocales(): string[];
338
- }
339
- /**
340
- * Interface for arithmetic operations
341
- */
342
- export interface IDateArithmetic {
343
- add(units: Partial<Record<Unit, number>> | IDuration): TimeGuard;
344
- subtract(units: Partial<Record<Unit, number>> | IDuration): TimeGuard;
345
- diff(other: TimeGuard): IDiffResult;
346
- diff(other: TimeGuard, unit: Unit): number;
347
- until(other: TimeGuard, options?: IDurationOptions): IDurationResult;
348
- since(other: TimeGuard, options?: IDurationOptions): IDurationResult;
349
- round(options: IRoundOptions): TimeGuard;
350
- }
351
- /**
352
- * Interface for query operations
353
- */
354
- export interface IDateQuery {
355
- isBefore(other: TimeGuard): boolean;
356
- isAfter(other: TimeGuard): boolean;
357
- isSame(other: TimeGuard, unit?: Unit): boolean;
358
- isBetween(start: TimeGuard, end: TimeGuard, unit?: Unit, inclusivity?: '[)' | '()' | '[]' | '(]'): boolean;
359
- }
360
- /**
361
- * Interface for manipulation operations
362
- */
363
- export interface IDateManipulation {
364
- clone(): TimeGuard;
365
- startOf(unit: Unit): TimeGuard;
366
- endOf(unit: Unit): TimeGuard;
367
- set(values: Partial<Record<Unit, number>>): TimeGuard;
368
- year(): number;
369
- month(): number;
370
- day(): number;
371
- hour(): number;
372
- minute(): number;
373
- second(): number;
374
- millisecond(): number;
375
- dayOfWeek(): number;
376
- dayOfYear(): number;
377
- weekOfYear(): number;
378
- daysInMonth(): number;
379
- daysInYear(): number;
380
- inLeapYear(): boolean;
381
- }
382
- /**
383
- * Interface for timezone operations
384
- */
385
- export interface ITimezoneAdapter {
386
- toTimezone(date: any, timezone: string): any;
387
- fromTimezone(date: any, targetTimezone: string): any;
388
- getOffset(timezone: string): number;
389
- }
390
- /**
391
- * Main TimeGuard interface (Facade Pattern)
392
- */
393
- export interface ITimeGuard extends IDateArithmetic, IDateQuery, IDateManipulation {
394
- /**
395
- * Get the underlying Temporal date object
396
- */
397
- toTemporal(): any;
398
- /**
399
- * Get as JavaScript Date (compatibility)
400
- */
401
- toDate(): Date;
402
- /**
403
- * Get as ISO string
404
- */
405
- toISOString(): string;
406
- /**
407
- * Get as Unix timestamp (milliseconds)
408
- */
409
- valueOf(): number;
410
- /**
411
- * Format the date with pattern or preset
412
- */
413
- format(pattern: string | FormatPreset): string;
414
- /**
415
- * Get accessor for components
416
- */
417
- get(component: Unit): number;
418
- /**
419
- * Locale of this instance
420
- */
421
- locale(): string;
422
- /**
423
- * Clone with new locale
424
- */
425
- locale(locale: string): TimeGuard;
426
- /**
427
- * Timezone info
428
- */
429
- timezone(): string | null;
430
- /**
431
- * Convert to another timezone
432
- */
433
- timezone(timezone: string): TimeGuard;
434
- /**
435
- * Get Unix timestamp in seconds
436
- */
437
- unix(): number;
438
- /**
439
- * Convert to JSON
440
- */
441
- toJSON(): string;
442
- /**
443
- * String representation
444
- */
445
- toString(): string;
446
- /**
447
- * Convert to PlainDate object
448
- */
449
- toPlainDate(): {
450
- year: number;
451
- month: number;
452
- day: number;
453
- dayOfWeek: number;
454
- };
455
- /**
456
- * Convert to PlainTime object
457
- */
458
- toPlainTime(): {
459
- hour: number;
460
- minute: number;
461
- second: number;
462
- millisecond: number;
463
- };
464
- /**
465
- * Get timezone offset (±HH:mm format or Z)
466
- */
467
- getOffset(): string;
468
- /**
469
- * Get timezone offset in nanoseconds
470
- */
471
- getOffsetNanoseconds(): number;
472
- /**
473
- * Get timezone ID
474
- */
475
- getTimeZoneId(): string | null;
476
- /**
477
- * Start of day
478
- */
479
- startOfDay(): TimeGuard;
480
- /**
481
- * End of day
482
- */
483
- endOfDay(): TimeGuard;
484
- /**
485
- * Duration from another date (inverse of until)
486
- */
487
- since(other: TimeGuard, options?: IDurationOptions): IDurationResult;
488
- /**
489
- * ISO 8601 duration string (P1Y2M3DT4H5M6S)
490
- */
491
- toDurationString(other?: TimeGuard): string;
492
- /**
493
- * Check if in past
494
- */
495
- isPast(): boolean;
496
- /**
497
- * Check if in future
498
- */
499
- isFuture(): boolean;
500
- /**
501
- * Check if today
502
- */
503
- isToday(): boolean;
504
- /**
505
- * Check if tomorrow
506
- */
507
- isTomorrow(): boolean;
508
- /**
509
- * Check if yesterday
510
- */
511
- isYesterday(): boolean;
512
- }
513
- /**
514
- * Plugin interface for extending functionality
515
- */
516
- export interface ITimeGuardPlugin {
517
- name: string;
518
- version: string;
519
- install(timeGuard: typeof TimeGuard, config?: unknown): void;
520
- }
521
- /**
522
- * Factory interface
523
- */
524
- export interface ITimeGuardFactory {
525
- create(input?: unknown, config?: ITimeGuardConfig): ITimeGuard;
526
- now(config?: ITimeGuardConfig): ITimeGuard;
527
- fromTemporal(date: any, config?: ITimeGuardConfig): ITimeGuard;
528
- }
529
- /**
530
- * Forward declaration for TimeGuard class
531
- * Implementation is in ./index.ts, exported via ./index.ts
532
- */
533
- export declare class TimeGuard {
534
- constructor(input?: unknown, config?: ITimeGuardConfig);
535
- }
536
- /**
537
- * Forward declaration for DurationResult class
538
- * Implementation is in ./index.ts, exported via ./index.ts
539
- */
540
- export declare class DurationResult implements IDurationResult {
541
- constructor(parts: DurationParts, locale?: string, metadata?: {
542
- startDate?: string;
543
- endDate?: string;
544
- steps?: string[];
545
- mode?: 'exact' | 'estimated';
546
- leapYearFlags?: Array<{
547
- year: number;
548
- isLeap: boolean;
549
- daysInFebruary: number;
550
- }>;
551
- calculationTimeMs?: number;
552
- });
553
- years: number;
554
- months: number;
555
- weeks: number;
556
- days: number;
557
- hours: number;
558
- minutes: number;
559
- seconds: number;
560
- milliseconds: number;
561
- humanize(options?: {
562
- locale?: string;
563
- fullBreakdown?: boolean;
564
- numeric?: 'always' | 'auto';
565
- }): string;
566
- total(unit: Unit): number;
567
- toString(): string;
568
- toJSON(): Record<string, number>;
569
- explain(): IDurationExplanation;
570
- }
571
- /**
572
- * Forward declaration for TimeRange class
573
- * Fluent API for date range operations with semantic naming
574
- * Implementation is in ./index.ts, exported via ./index.ts
575
- */
576
- export declare class TimeRange {
577
- constructor(start: TimeGuard, end: TimeGuard);
578
- toDuration(): DurationResult;
579
- inMonths(): number;
580
- humanize(options?: {
581
- locale?: string;
582
- fullBreakdown?: boolean;
583
- numeric?: 'always' | 'auto';
584
- }): string;
585
- in(unit: Unit): number;
586
- }
File without changes
File without changes
File without changes