@bereasoftware/time-guard 2.5.2 → 2.5.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.
Files changed (50) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/calendars/index.es.js +1 -1
  4. package/dist/plugins/advanced-format.cjs.map +1 -1
  5. package/dist/plugins/advanced-format.es.js +1 -1
  6. package/dist/plugins/advanced-format.es.js.map +1 -1
  7. package/dist/plugins/duration.cjs.map +1 -1
  8. package/dist/plugins/duration.es.js +1 -1
  9. package/dist/plugins/duration.es.js.map +1 -1
  10. package/dist/plugins/relative-time.cjs.map +1 -1
  11. package/dist/plugins/relative-time.es.js +1 -1
  12. package/dist/plugins/relative-time.es.js.map +1 -1
  13. package/dist/time-guard.cjs +1 -1
  14. package/dist/time-guard.cjs.map +1 -1
  15. package/dist/time-guard.es.js +3586 -3587
  16. package/dist/time-guard.es.js.map +1 -1
  17. package/dist/time-guard.iife.js +1 -1
  18. package/dist/time-guard.iife.js.map +1 -1
  19. package/dist/time-guard.umd.js +1 -1
  20. package/dist/time-guard.umd.js.map +1 -1
  21. package/dist/types/calendars/index.d.ts +1 -81
  22. package/dist/types/index.d.ts +1 -20
  23. package/dist/types/locales/index.d.ts +1 -17
  24. package/dist/types/plugins/advanced-format.d.ts +1 -0
  25. package/dist/types/plugins/duration.d.ts +1 -0
  26. package/dist/types/plugins/relative-time.d.ts +1 -0
  27. package/package.json +6 -6
  28. package/dist/types/adapters/temporal.adapter.d.ts +0 -66
  29. package/dist/types/calendars/calendar.manager.d.ts +0 -52
  30. package/dist/types/formatters/date.formatter.d.ts +0 -21
  31. package/dist/types/locales/additional.locale.d.ts +0 -5
  32. package/dist/types/locales/asian.locale.d.ts +0 -9
  33. package/dist/types/locales/english.locale.d.ts +0 -6
  34. package/dist/types/locales/european.locale.d.ts +0 -9
  35. package/dist/types/locales/locale.manager.d.ts +0 -42
  36. package/dist/types/locales/middle-eastern.locale.d.ts +0 -5
  37. package/dist/types/locales/nordic.locale.d.ts +0 -6
  38. package/dist/types/locales/romance.locale.d.ts +0 -7
  39. package/dist/types/locales/slavic.locale.d.ts +0 -6
  40. package/dist/types/locales/spanish.locale.d.ts +0 -5
  41. package/dist/types/plugins/advanced-format/index.d.ts +0 -15
  42. package/dist/types/plugins/duration/index.d.ts +0 -107
  43. package/dist/types/plugins/duration/types.d.ts +0 -85
  44. package/dist/types/plugins/index.d.ts +0 -10
  45. package/dist/types/plugins/manager.d.ts +0 -58
  46. package/dist/types/plugins/relative-time/index.d.ts +0 -39
  47. package/dist/types/plugins/relative-time/types.d.ts +0 -27
  48. package/dist/types/time-guard.d.ts +0 -270
  49. package/dist/types/types/index.d.ts +0 -586
  50. package/dist/types/utils/duration-locale.d.ts +0 -33
@@ -1,81 +1 @@
1
- import { ICalendarSystem } from '../types';
2
- /**
3
- * Islamic Calendar (Hijri)
4
- * @experimental Uses simplified calculations. May not be accurate for all dates.
5
- */
6
- export declare class IslamicCalendar implements ICalendarSystem {
7
- readonly id = "islamic";
8
- readonly name = "Islamic Calendar (Hijri)";
9
- readonly locale = "ar";
10
- private monthNames;
11
- getMonthName(month: number): string;
12
- getWeekdayName(day: number, short?: boolean): string;
13
- isLeapYear(year: number): boolean;
14
- daysInMonth(year: number, month: number): number;
15
- daysInYear(year: number): number;
16
- }
17
- /**
18
- * Hebrew Calendar
19
- * @experimental Uses simplified calculations. May not be accurate for all dates.
20
- */
21
- export declare class HebrewCalendar implements ICalendarSystem {
22
- readonly id = "hebrew";
23
- readonly name = "Hebrew Calendar";
24
- readonly locale = "he";
25
- private monthNames;
26
- getMonthName(month: number): string;
27
- getWeekdayName(day: number, short?: boolean): string;
28
- isLeapYear(year: number): boolean;
29
- daysInMonth(_year: number, month: number): number;
30
- daysInYear(year: number): number;
31
- }
32
- /**
33
- * Chinese Calendar
34
- * @experimental Uses simplified calculations. May not be accurate for all dates.
35
- */
36
- export declare class ChineseCalendar implements ICalendarSystem {
37
- readonly id = "chinese";
38
- readonly name = "Chinese Calendar";
39
- readonly locale = "zh";
40
- private monthNames;
41
- private terrestrialBranches;
42
- getMonthName(month: number): string;
43
- getWeekdayName(day: number, short?: boolean): string;
44
- isLeapYear(year: number): boolean;
45
- daysInMonth(_year: number, month: number): number;
46
- daysInYear(year: number): number;
47
- /**
48
- * Get zodiac sign for year
49
- */
50
- getZodiacSign(year: number): string;
51
- }
52
- /**
53
- * Japanese Calendar
54
- * @experimental Uses Gregorian rules post-1873. Historical dates may not be accurate.
55
- */
56
- export declare class JapaneseCalendar implements ICalendarSystem {
57
- readonly id = "japanese";
58
- readonly name = "Japanese Calendar";
59
- readonly locale = "ja";
60
- private monthNames;
61
- getMonthName(month: number): string;
62
- getWeekdayName(day: number, short?: boolean): string;
63
- isLeapYear(year: number): boolean;
64
- daysInMonth(year: number, month: number): number;
65
- daysInYear(year: number): number;
66
- }
67
- /**
68
- * Buddhist Calendar
69
- * @experimental Uses Gregorian rules with BE year offset (CE + 543).
70
- */
71
- export declare class BuddhistCalendar implements ICalendarSystem {
72
- readonly id = "buddhist";
73
- readonly name = "Buddhist Calendar";
74
- readonly locale = "th";
75
- private monthNames;
76
- getMonthName(month: number): string;
77
- getWeekdayName(day: number): string;
78
- isLeapYear(year: number): boolean;
79
- daysInMonth(year: number, month: number): number;
80
- daysInYear(year: number): number;
81
- }
1
+ export {}
@@ -1,20 +1 @@
1
- import { TimeGuard } from './time-guard';
2
- import { ITimeGuardConfig } from './types';
3
- import { LocaleManager, EN_LOCALE, ES_LOCALE } from './locales/locale.manager';
4
- export * from './time-guard';
5
- export type { ITimeGuard, ITimeGuardConfig, ITimeGuardFactory, ITimeGuardPlugin, IDateParser, IDateFormatter, ILocaleManager, IDateArithmetic, IDateQuery, IDateManipulation, ITimezoneAdapter, ICalendarSystem, ICalendarManager, IRoundOptions, IDurationOptions, IDurationResult, IDurationExplanation, IHumanizeOptions, IDiffResult, IDiffOptions, DurationParts, Unit, FormatPreset, ILocale, } from './types';
6
- export { TemporalAdapter } from './adapters/temporal.adapter';
7
- export { LocaleManager, EN_LOCALE, ES_LOCALE };
8
- export { getAvailableLocales, LOCALES_COUNT, ALL_LOCALES, registerAllLocales } from './locales/index';
9
- export { DateFormatter } from './formatters/date.formatter';
10
- export { CalendarManager, GregorianCalendar, calendarManager, } from './calendars/calendar.manager';
11
- export { IslamicCalendar, HebrewCalendar, ChineseCalendar, JapaneseCalendar, BuddhistCalendar, } from './calendars/index';
12
- export * from './plugins/index';
13
- export { PluginManager } from './plugins/manager';
14
- export { RelativeTimePlugin, default as relativeTimePlugin } from './plugins/relative-time';
15
- export type { RelativeTimeConfig, RelativeTimeFormats, RelativeTimeThreshold } from './plugins/relative-time/types';
16
- export { DurationPlugin, Duration, default as durationPlugin } from './plugins/duration';
17
- export type { IDuration, DurationInput, DurationObject, DurationUnit } from './plugins/duration/types';
18
- export { AdvancedFormatPlugin, default as advancedFormatPlugin } from './plugins/advanced-format';
19
- export declare function timeGuard(input?: unknown, config?: ITimeGuardConfig): TimeGuard;
20
- export declare const version: string;
1
+ export {}
@@ -1,17 +1 @@
1
- import { ILocale } from '../types';
2
- /**
3
- * Aggregated locale data from all modules
4
- */
5
- export declare const ALL_LOCALES: Record<string, ILocale>;
6
- /**
7
- * Register all locales into a locale map
8
- */
9
- export declare function registerAllLocales(localeMap: Map<string, ILocale> | Record<string, ILocale>): void;
10
- /**
11
- * Get all available locales
12
- */
13
- export declare function getAvailableLocales(): string[];
14
- /**
15
- * Total locales count (minimum 40 required)
16
- */
17
- export declare const LOCALES_COUNT = 40;
1
+ export {}
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1 @@
1
+ export {}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bereasoftware/time-guard",
3
3
  "private": false,
4
- "version": "2.5.2",
4
+ "version": "2.5.3",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/time-guard.cjs",
8
8
  "module": "./dist/time-guard.es.js",
9
- "types": "./dist/types/time-guard.d.ts",
9
+ "types": "./dist/types/index.d.ts",
10
10
  "unpkg": "./dist/time-guard.umd.js",
11
11
  "browser": {
12
12
  "./dist/time-guard.umd.js": "./dist/time-guard.umd.js",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "exports": {
16
16
  ".": {
17
- "types": "./dist/types/time-guard.d.ts",
17
+ "types": "./dist/types/index.d.ts",
18
18
  "import": "./dist/time-guard.es.js",
19
19
  "require": "./dist/time-guard.cjs",
20
20
  "default": "./dist/time-guard.es.js"
@@ -32,19 +32,19 @@
32
32
  "default": "./dist/calendars/index.es.js"
33
33
  },
34
34
  "./plugins/relative-time": {
35
- "types": "./dist/types/plugins/relative-time/index.d.ts",
35
+ "types": "./dist/types/plugins/relative-time.d.ts",
36
36
  "import": "./dist/plugins/relative-time.es.js",
37
37
  "require": "./dist/plugins/relative-time.cjs",
38
38
  "default": "./dist/plugins/relative-time.es.js"
39
39
  },
40
40
  "./plugins/duration": {
41
- "types": "./dist/types/plugins/duration/index.d.ts",
41
+ "types": "./dist/types/plugins/duration.d.ts",
42
42
  "import": "./dist/plugins/duration.es.js",
43
43
  "require": "./dist/plugins/duration.cjs",
44
44
  "default": "./dist/plugins/duration.es.js"
45
45
  },
46
46
  "./plugins/advanced-format": {
47
- "types": "./dist/types/plugins/advanced-format/index.d.ts",
47
+ "types": "./dist/types/plugins/advanced-format.d.ts",
48
48
  "import": "./dist/plugins/advanced-format.es.js",
49
49
  "require": "./dist/plugins/advanced-format.cjs",
50
50
  "default": "./dist/plugins/advanced-format.es.js"
@@ -1,66 +0,0 @@
1
- import { Temporal } from '@js-temporal/polyfill';
2
- type TemporalPlainDateTime = Temporal.PlainDateTime;
3
- type TemporalZonedDateTime = Temporal.ZonedDateTime;
4
- /**
5
- * Adapter for Temporal date/time operations
6
- */
7
- export declare class TemporalAdapter {
8
- /**
9
- * Parse various input formats to Temporal.PlainDateTime
10
- */
11
- static parseToPlainDateTime(input: unknown): TemporalPlainDateTime;
12
- /**
13
- * Convert JavaScript Date to Temporal.PlainDateTime
14
- */
15
- static fromDate(date: Date): TemporalPlainDateTime;
16
- /**
17
- * Convert Unix timestamp (milliseconds) to Temporal.PlainDateTime
18
- */
19
- static fromUnix(timestamp: number): TemporalPlainDateTime;
20
- /**
21
- * Parse ISO string to Temporal.PlainDateTime
22
- */
23
- static parseISOString(iso: string): TemporalPlainDateTime;
24
- /**
25
- * Create from object with date components
26
- */
27
- static fromObject(obj: Record<string, any>): TemporalPlainDateTime;
28
- /**
29
- * Convert Temporal.PlainDateTime to JavaScript Date
30
- */
31
- static toDate(temporal: TemporalPlainDateTime | TemporalZonedDateTime): Date;
32
- /**
33
- * Convert to Unix timestamp (milliseconds)
34
- */
35
- static toUnix(temporal: TemporalPlainDateTime | TemporalZonedDateTime): number;
36
- /**
37
- * Convert to ISO string
38
- */
39
- static toISOString(temporal: TemporalPlainDateTime | TemporalZonedDateTime): string;
40
- /**
41
- * Ensure we have a PlainDateTime
42
- */
43
- static toPlainDateTime(temporal: TemporalPlainDateTime | TemporalZonedDateTime): TemporalPlainDateTime;
44
- /**
45
- * Type guards
46
- */
47
- static isPlainDateTime(obj: unknown): obj is TemporalPlainDateTime;
48
- static isZonedDateTime(obj: unknown): obj is TemporalZonedDateTime;
49
- static isPlainDate(obj: unknown): obj is any;
50
- static isPlainTime(obj: unknown): obj is any;
51
- /**
52
- * Get current time as PlainDateTime
53
- */
54
- static now(): TemporalPlainDateTime;
55
- /**
56
- * Get current time as ZonedDateTime with timezone
57
- */
58
- static nowInTimezone(timezone: string): TemporalZonedDateTime;
59
- /**
60
- * Compare two Temporal.PlainDateTime objects
61
- * Returns: -1 if dt1 < dt2, 0 if equal, 1 if dt1 > dt2
62
- * Uses ISO string comparison as fallback for polyfills that don't have Temporal.PlainDateTime.compare
63
- */
64
- static compare(dt1: TemporalPlainDateTime, dt2: TemporalPlainDateTime): number;
65
- }
66
- export {};
@@ -1,52 +0,0 @@
1
- import { ICalendarSystem, ICalendarManager } from '../types';
2
- /**
3
- * Gregorian Calendar System (ISO 8601 default)
4
- */
5
- export declare class GregorianCalendar implements ICalendarSystem {
6
- readonly id = "gregory";
7
- readonly name = "Gregorian Calendar";
8
- readonly locale = "en";
9
- private monthNames;
10
- private monthNamesShort;
11
- private weekdayNames;
12
- private weekdayNamesShort;
13
- getMonthName(month: number, short?: boolean): string;
14
- getWeekdayName(day: number, short?: boolean): string;
15
- isLeapYear(year: number): boolean;
16
- daysInMonth(year: number, month: number): number;
17
- daysInYear(year: number): number;
18
- }
19
- /**
20
- * Calendar Manager - Singleton for managing calendar systems
21
- */
22
- export declare class CalendarManager implements ICalendarManager {
23
- private static instance;
24
- private calendars;
25
- private defaultCalendar;
26
- private constructor();
27
- /**
28
- * Get singleton instance
29
- */
30
- static getInstance(): CalendarManager;
31
- /**
32
- * Register a new calendar system
33
- */
34
- register(calendar: ICalendarSystem): void;
35
- /**
36
- * Get calendar by ID
37
- */
38
- get(id: string): ICalendarSystem | undefined;
39
- /**
40
- * List all available calendars
41
- */
42
- list(): string[];
43
- /**
44
- * Set default calendar
45
- */
46
- setDefault(id: string): void;
47
- /**
48
- * Get default calendar
49
- */
50
- getDefault(): ICalendarSystem;
51
- }
52
- export declare const calendarManager: CalendarManager;
@@ -1,21 +0,0 @@
1
- import { IDateFormatter, FormatPreset } from '../types';
2
- import { Temporal } from '@js-temporal/polyfill';
3
- /**
4
- * Date Formatter implementation
5
- */
6
- export declare class DateFormatter implements IDateFormatter {
7
- private localeManager;
8
- constructor();
9
- /**
10
- * Format date with pattern and locale
11
- */
12
- format(date: Temporal.PlainDateTime, pattern: string, locale?: string): string;
13
- /**
14
- * Get format pattern for preset
15
- */
16
- getPreset(preset: FormatPreset): string;
17
- /**
18
- * Format with preset
19
- */
20
- formatPreset(date: Temporal.PlainDateTime, preset: FormatPreset, locale?: string): string;
21
- }
@@ -1,5 +0,0 @@
1
- import { ILocale } from '../types';
2
- export declare const VI_LOCALE_DATA: ILocale;
3
- export declare const ID_LOCALE_DATA: ILocale;
4
- export declare const TH_LOCALE_DATA: ILocale;
5
- export declare const ADDITIONAL_LOCALES: Record<string, ILocale>;
@@ -1,9 +0,0 @@
1
- import { ILocale } from '../types';
2
- export declare const JA_LOCALE_DATA: ILocale;
3
- export declare const ZH_CN_LOCALE_DATA: ILocale;
4
- export declare const ZH_TW_LOCALE_DATA: ILocale;
5
- export declare const KO_LOCALE_DATA: ILocale;
6
- export declare const TH_LOCALE_DATA: ILocale;
7
- export declare const VI_LOCALE_DATA: ILocale;
8
- export declare const ID_LOCALE_DATA: ILocale;
9
- export declare const ASIAN_LOCALES: Record<string, ILocale>;
@@ -1,6 +0,0 @@
1
- import { ILocale } from '../types';
2
- export declare const EN_LOCALE_DATA: ILocale;
3
- export declare const EN_AU_LOCALE_DATA: ILocale;
4
- export declare const EN_GB_LOCALE_DATA: ILocale;
5
- export declare const EN_CA_LOCALE_DATA: ILocale;
6
- export declare const ENGLISH_LOCALES: Record<string, ILocale>;
@@ -1,9 +0,0 @@
1
- import { ILocale } from '../types';
2
- export declare const DE_LOCALE_DATA: ILocale;
3
- export declare const NL_LOCALE_DATA: ILocale;
4
- export declare const EL_LOCALE_DATA: ILocale;
5
- export declare const HU_LOCALE_DATA: ILocale;
6
- export declare const EU_LOCALE_DATA: ILocale;
7
- export declare const CA_LOCALE_DATA: ILocale;
8
- export declare const TR_LOCALE_DATA: ILocale;
9
- export declare const EUROPEAN_LOCALES: Record<string, ILocale>;
@@ -1,42 +0,0 @@
1
- import { ILocale, ILocaleManager } from '../types';
2
- /**
3
- * English locale data
4
- */
5
- export declare const EN_LOCALE: ILocale;
6
- /**
7
- * Spanish locale data (sample for i18n support)
8
- */
9
- export declare const ES_LOCALE: ILocale;
10
- /**
11
- * Locale Manager - implements ILocaleManager
12
- */
13
- export declare class LocaleManager implements ILocaleManager {
14
- private static instance;
15
- private locales;
16
- private currentLocale;
17
- /**
18
- * Singleton pattern
19
- */
20
- static getInstance(): LocaleManager;
21
- private constructor();
22
- /**
23
- * Set or register a locale
24
- */
25
- setLocale(locale: string, data?: ILocale): void;
26
- /**
27
- * Get locale information
28
- */
29
- getLocale(locale?: string): ILocale;
30
- /**
31
- * List all registered locales
32
- */
33
- listLocales(): string[];
34
- /**
35
- * Get current locale
36
- */
37
- getCurrentLocale(): string;
38
- /**
39
- * Load multiple locales
40
- */
41
- loadLocales(locales: Record<string, ILocale>): void;
42
- }
@@ -1,5 +0,0 @@
1
- import { ILocale } from '../types';
2
- export declare const AR_LOCALE_DATA: ILocale;
3
- export declare const HE_LOCALE_DATA: ILocale;
4
- export declare const HI_LOCALE_DATA: ILocale;
5
- export declare const MIDDLE_EASTERN_LOCALES: Record<string, ILocale>;
@@ -1,6 +0,0 @@
1
- import { ILocale } from '../types';
2
- export declare const SV_LOCALE_DATA: ILocale;
3
- export declare const NB_LOCALE_DATA: ILocale;
4
- export declare const DA_LOCALE_DATA: ILocale;
5
- export declare const FI_LOCALE_DATA: ILocale;
6
- export declare const NORDIC_LOCALES: Record<string, ILocale>;
@@ -1,7 +0,0 @@
1
- import { ILocale } from '../types';
2
- export declare const FR_LOCALE_DATA: ILocale;
3
- export declare const IT_LOCALE_DATA: ILocale;
4
- export declare const PT_LOCALE_DATA: ILocale;
5
- export declare const PT_BR_LOCALE_DATA: ILocale;
6
- export declare const RO_LOCALE_DATA: ILocale;
7
- export declare const ROMANCE_LOCALES: Record<string, ILocale>;
@@ -1,6 +0,0 @@
1
- import { ILocale } from '../types';
2
- export declare const RU_LOCALE_DATA: ILocale;
3
- export declare const PL_LOCALE_DATA: ILocale;
4
- export declare const CS_LOCALE_DATA: ILocale;
5
- export declare const SK_LOCALE_DATA: ILocale;
6
- export declare const SLAVIC_LOCALES: Record<string, ILocale>;
@@ -1,5 +0,0 @@
1
- import { ILocale } from '../types';
2
- export declare const ES_LOCALE_DATA: ILocale;
3
- export declare const ES_MX_LOCALE_DATA: ILocale;
4
- export declare const ES_US_LOCALE_DATA: ILocale;
5
- export declare const SPANISH_LOCALES: Record<string, ILocale>;
@@ -1,15 +0,0 @@
1
- import { ITimeGuardPlugin } from '../../types';
2
- import { TimeGuard } from '../../time-guard';
3
- export declare class AdvancedFormatPlugin implements ITimeGuardPlugin {
4
- name: string;
5
- version: string;
6
- /**
7
- * Install plugin into TimeGuard
8
- */
9
- install(TimeGuardClass: typeof TimeGuard): void;
10
- }
11
- /**
12
- * Create and export default instance
13
- */
14
- declare const _default: AdvancedFormatPlugin;
15
- export default _default;
@@ -1,107 +0,0 @@
1
- import { ITimeGuardPlugin } from '../../types';
2
- import { TimeGuard } from '../../time-guard';
3
- import { DurationInput, DurationObject, DurationUnit, IDuration } from './types';
4
- /**
5
- * Duration class - represents time span following ISO 8601 standard
6
- */
7
- export declare class Duration implements IDuration {
8
- private years;
9
- private months;
10
- private weeks;
11
- private days;
12
- private hours;
13
- private minutes;
14
- private seconds;
15
- private milliseconds;
16
- constructor(input: DurationInput);
17
- /**
18
- * Create Duration from ISO 8601 string
19
- * @example Duration.fromISO("P3Y6M4DT12H30M5S")
20
- */
21
- static fromISO(iso: string): Duration;
22
- /**
23
- * Create a Duration between this date and another
24
- */
25
- static between(from: TimeGuard, to: TimeGuard): Duration;
26
- /**
27
- * Create Duration from milliseconds
28
- */
29
- static fromMilliseconds(ms: number): Duration;
30
- /**
31
- * Get duration in specific unit
32
- */
33
- as(unit: DurationUnit): number;
34
- /**
35
- * Get duration as milliseconds
36
- */
37
- asMilliseconds(): number;
38
- /**
39
- * Get duration as seconds
40
- */
41
- asSeconds(): number;
42
- /**
43
- * Get duration as minutes
44
- */
45
- asMinutes(): number;
46
- /**
47
- * Get duration as hours
48
- */
49
- asHours(): number;
50
- /**
51
- * Get duration as days
52
- */
53
- asDays(): number;
54
- /**
55
- * Get duration as weeks
56
- */
57
- asWeeks(): number;
58
- /**
59
- * Get duration as months
60
- */
61
- asMonths(): number;
62
- /**
63
- * Get duration as years
64
- */
65
- asYears(): number;
66
- /**
67
- * Get all components
68
- */
69
- toObject(): DurationObject;
70
- /**
71
- * Get ISO 8601 string representation
72
- * @example "P3Y6M4DT12H30M5S"
73
- */
74
- toISO(): string;
75
- /**
76
- * Get human-readable string
77
- */
78
- humanize(): string;
79
- /**
80
- * Check if duration is negative
81
- */
82
- isNegative(): boolean;
83
- /**
84
- * Get absolute duration
85
- */
86
- abs(): Duration;
87
- /**
88
- * String representation
89
- */
90
- toString(): string;
91
- }
92
- /**
93
- * Duration Plugin
94
- */
95
- export declare class DurationPlugin implements ITimeGuardPlugin {
96
- name: string;
97
- version: string;
98
- /**
99
- * Install plugin into TimeGuard
100
- */
101
- install(TimeGuardClass: typeof TimeGuard): void;
102
- }
103
- /**
104
- * Create and export default instance
105
- */
106
- export declare const durationPlugin: DurationPlugin;
107
- export default durationPlugin;
@@ -1,85 +0,0 @@
1
- /**
2
- * Duration Plugin Types
3
- */
4
- export type DurationUnit = 'years' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds';
5
- export interface DurationInput {
6
- years?: number;
7
- months?: number;
8
- weeks?: number;
9
- days?: number;
10
- hours?: number;
11
- minutes?: number;
12
- seconds?: number;
13
- milliseconds?: number;
14
- }
15
- export interface DurationObject {
16
- years: number;
17
- months: number;
18
- weeks: number;
19
- days: number;
20
- hours: number;
21
- minutes: number;
22
- seconds: number;
23
- milliseconds: number;
24
- }
25
- /**
26
- * Duration class for ISO 8601 durations
27
- */
28
- export interface IDuration {
29
- /**
30
- * Get duration in specific unit
31
- */
32
- as(unit: DurationUnit): number;
33
- /**
34
- * Get duration as milliseconds
35
- */
36
- asMilliseconds(): number;
37
- /**
38
- * Get duration as seconds
39
- */
40
- asSeconds(): number;
41
- /**
42
- * Get duration as minutes
43
- */
44
- asMinutes(): number;
45
- /**
46
- * Get duration as hours
47
- */
48
- asHours(): number;
49
- /**
50
- * Get duration as days
51
- */
52
- asDays(): number;
53
- /**
54
- * Get duration as weeks
55
- */
56
- asWeeks(): number;
57
- /**
58
- * Get duration as months
59
- */
60
- asMonths(): number;
61
- /**
62
- * Get duration as years
63
- */
64
- asYears(): number;
65
- /**
66
- * Get all components
67
- */
68
- toObject(): DurationObject;
69
- /**
70
- * Get ISO 8601 string representation
71
- */
72
- toISO(): string;
73
- /**
74
- * Get human-readable string
75
- */
76
- humanize(): string;
77
- /**
78
- * Check if duration is negative
79
- */
80
- isNegative(): boolean;
81
- /**
82
- * Get absolute duration
83
- */
84
- abs(): IDuration;
85
- }
@@ -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';