@forcecalendar/core 2.1.70 → 2.2.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.
@@ -0,0 +1,134 @@
1
+ /**
2
+ * TimezoneManager - Comprehensive timezone handling for global calendar operations
3
+ * Handles timezone conversions, DST transitions, and IANA timezone database
4
+ *
5
+ * Critical for Salesforce orgs spanning multiple timezones
6
+ */
7
+ import { TimezoneDatabase } from './TimezoneDatabase.js';
8
+ export declare class TimezoneManager {
9
+ database: TimezoneDatabase;
10
+ offsetCache: Map<any, any>;
11
+ dstCache: Map<any, any>;
12
+ formatterCache: Map<any, any>;
13
+ maxCacheSize: number;
14
+ maxOffsetBucketsPerZone: number;
15
+ cacheHits: number;
16
+ cacheMisses: number;
17
+ /**
18
+ * Get the shared singleton instance of TimezoneManager
19
+ * This should be used instead of creating new instances to avoid memory bloat
20
+ * @returns {TimezoneManager} The shared instance
21
+ */
22
+ static getInstance(): TimezoneManager;
23
+ /**
24
+ * Reset the singleton instance (useful for testing)
25
+ * @private
26
+ */
27
+ private static _resetInstance;
28
+ constructor();
29
+ /**
30
+ * Convert date from one timezone to another
31
+ * @param {Date} date - Date to convert
32
+ * @param {string} fromTimezone - Source timezone (IANA identifier)
33
+ * @param {string} toTimezone - Target timezone (IANA identifier)
34
+ * @returns {Date} Converted date
35
+ */
36
+ convertTimezone(date: Date, fromTimezone: string, toTimezone: string): Date;
37
+ /**
38
+ * Convert date to UTC
39
+ * @param {Date} date - Date in local timezone
40
+ * @param {string} timezone - Source timezone
41
+ * @returns {Date} Date in UTC
42
+ */
43
+ toUTC(date: Date, timezone: string): Date;
44
+ /**
45
+ * Convert UTC date to timezone
46
+ * @param {Date} utcDate - Date in UTC
47
+ * @param {string} timezone - Target timezone
48
+ * @returns {Date} Date in specified timezone
49
+ */
50
+ fromUTC(utcDate: Date, timezone: string): Date;
51
+ /**
52
+ * Get timezone offset in minutes
53
+ * @param {Date} date - Date to check (for DST calculation)
54
+ * @param {string} timezone - Timezone identifier
55
+ * @returns {number} Offset in minutes from UTC
56
+ */
57
+ getTimezoneOffset(date: Date, timezone: string): number;
58
+ /**
59
+ * Get a cached Intl.DateTimeFormat for a timezone
60
+ * @param {string} timezone - Timezone identifier
61
+ * @returns {Intl.DateTimeFormat}
62
+ * @private
63
+ */
64
+ private _getFormatter;
65
+ /**
66
+ * Check if date is in DST for given timezone
67
+ * @param {Date} date - Date to check
68
+ * @param {string} timezone - Timezone identifier
69
+ * @param {Object} [dstRule] - DST rule object (optional, will fetch if not provided)
70
+ * @returns {boolean} True if in DST
71
+ */
72
+ isDST(date: Date, timezone: string, dstRule?: Object): boolean;
73
+ /**
74
+ * Get nth weekday of month
75
+ * @private
76
+ */
77
+ private getNthWeekdayOfMonth;
78
+ /**
79
+ * Get list of common timezones
80
+ * @returns {Array<{value: string, label: string, offset: string}>}
81
+ */
82
+ getCommonTimezones(): Array<{
83
+ value: string;
84
+ label: string;
85
+ offset: string;
86
+ }>;
87
+ /**
88
+ * Format date in specific timezone
89
+ * @param {Date} date - Date to format
90
+ * @param {string} timezone - Timezone for formatting
91
+ * @param {Object} options - Formatting options
92
+ * @returns {string} Formatted date string
93
+ */
94
+ formatInTimezone(date: Date, timezone: string, options?: Object): string;
95
+ /**
96
+ * Get timezone from browser/system
97
+ * @returns {string} IANA timezone identifier
98
+ */
99
+ getSystemTimezone(): string;
100
+ /**
101
+ * Parse timezone from string (handles abbreviations)
102
+ * @param {string} tzString - Timezone string
103
+ * @returns {string} IANA timezone identifier
104
+ */
105
+ parseTimezone(tzString: string): string;
106
+ /**
107
+ * Calculate timezone difference in hours
108
+ * @param {string} timezone1 - First timezone
109
+ * @param {string} timezone2 - Second timezone
110
+ * @param {Date} [date] - Date for DST calculation
111
+ * @returns {number} Hour difference
112
+ */
113
+ getTimezoneDifference(timezone1: string, timezone2: string, date?: Date): number;
114
+ /**
115
+ * Clear caches (useful when date changes significantly)
116
+ */
117
+ clearCache(): void;
118
+ /**
119
+ * Validate timezone identifier
120
+ * @param {string} timezone - Timezone to validate
121
+ * @returns {boolean} True if valid
122
+ */
123
+ isValidTimezone(timezone: string): boolean;
124
+ /**
125
+ * Get cache statistics
126
+ * @returns {Object} Cache stats
127
+ */
128
+ getCacheStats(): Object;
129
+ /**
130
+ * Manage cache size - evict old entries if needed
131
+ * @private
132
+ */
133
+ private _manageCacheSize;
134
+ }