@forcecalendar/core 2.1.70 → 2.3.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.
- package/core/calendar/Calendar.js +5 -5
- package/core/conflicts/ConflictDetector.js +5 -5
- package/core/events/Event.js +17 -17
- package/core/events/EventStore.js +16 -16
- package/core/events/RecurrenceEngine.js +229 -14
- package/core/ics/ICSHandler.js +5 -3
- package/core/index.js +5 -1
- package/core/state/StateManager.js +3 -3
- package/core/timezone/TimezoneManager.js +79 -1
- package/core/types.js +17 -14
- package/package.json +40 -20
- package/types/calendar/Calendar.d.ts +287 -0
- package/types/calendar/DateUtils.d.ts +298 -0
- package/types/conflicts/ConflictDetector.d.ts +103 -0
- package/types/events/Event.d.ts +329 -0
- package/types/events/EventStore.d.ts +341 -0
- package/types/events/RRuleParser.d.ts +60 -0
- package/types/events/RecurrenceEngine.d.ts +167 -0
- package/types/events/RecurrenceEngineV2.d.ts +140 -0
- package/types/ics/ICSHandler.d.ts +111 -0
- package/types/ics/ICSParser.d.ts +111 -0
- package/types/index.d.ts +22 -0
- package/types/integration/EnhancedCalendar.d.ts +76 -0
- package/types/performance/AdaptiveMemoryManager.d.ts +104 -0
- package/types/performance/LRUCache.d.ts +59 -0
- package/types/performance/PerformanceOptimizer.d.ts +134 -0
- package/types/search/EventSearch.d.ts +91 -0
- package/types/search/SearchWorkerManager.d.ts +116 -0
- package/types/state/StateManager.d.ts +200 -0
- package/types/timezone/TimezoneDatabase.d.ts +993 -0
- package/types/timezone/TimezoneManager.d.ts +154 -0
- package/types/types.d.ts +1225 -0
|
@@ -0,0 +1,154 @@
|
|
|
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
|
+
transitionCache: Map<any, any>;
|
|
14
|
+
maxCacheSize: number;
|
|
15
|
+
maxOffsetBucketsPerZone: number;
|
|
16
|
+
cacheHits: number;
|
|
17
|
+
cacheMisses: number;
|
|
18
|
+
/**
|
|
19
|
+
* Get the shared singleton instance of TimezoneManager
|
|
20
|
+
* This should be used instead of creating new instances to avoid memory bloat
|
|
21
|
+
* @returns {TimezoneManager} The shared instance
|
|
22
|
+
*/
|
|
23
|
+
static getInstance(): TimezoneManager;
|
|
24
|
+
/**
|
|
25
|
+
* Reset the singleton instance (useful for testing)
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
private static _resetInstance;
|
|
29
|
+
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Convert date from one timezone to another
|
|
32
|
+
* @param {Date} date - Date to convert
|
|
33
|
+
* @param {string} fromTimezone - Source timezone (IANA identifier)
|
|
34
|
+
* @param {string} toTimezone - Target timezone (IANA identifier)
|
|
35
|
+
* @returns {Date} Converted date
|
|
36
|
+
*/
|
|
37
|
+
convertTimezone(date: Date, fromTimezone: string, toTimezone: string): Date;
|
|
38
|
+
/**
|
|
39
|
+
* Convert date to UTC
|
|
40
|
+
* @param {Date} date - Date in local timezone
|
|
41
|
+
* @param {string} timezone - Source timezone
|
|
42
|
+
* @returns {Date} Date in UTC
|
|
43
|
+
*/
|
|
44
|
+
toUTC(date: Date, timezone: string): Date;
|
|
45
|
+
/**
|
|
46
|
+
* Convert UTC date to timezone
|
|
47
|
+
* @param {Date} utcDate - Date in UTC
|
|
48
|
+
* @param {string} timezone - Target timezone
|
|
49
|
+
* @returns {Date} Date in specified timezone
|
|
50
|
+
*/
|
|
51
|
+
fromUTC(utcDate: Date, timezone: string): Date;
|
|
52
|
+
/**
|
|
53
|
+
* Get timezone offset in minutes
|
|
54
|
+
* @param {Date} date - Date to check (for DST calculation)
|
|
55
|
+
* @param {string} timezone - Timezone identifier
|
|
56
|
+
* @returns {number} Offset in minutes from UTC
|
|
57
|
+
*/
|
|
58
|
+
getTimezoneOffset(date: Date, timezone: string): number;
|
|
59
|
+
/**
|
|
60
|
+
* Find the next instant at which the zone's UTC offset changes
|
|
61
|
+
* @param {string} timezone - Timezone identifier
|
|
62
|
+
* @param {number} fromMs - Search from this timestamp (exclusive)
|
|
63
|
+
* @param {number} toMs - Search up to this timestamp (inclusive)
|
|
64
|
+
* @returns {number} Timestamp of the first offset change after fromMs, or Infinity
|
|
65
|
+
*/
|
|
66
|
+
getNextTransition(timezone: string, fromMs: number, toMs: number): number;
|
|
67
|
+
/**
|
|
68
|
+
* Scan a range for offset transitions. Probes in 7-day steps (shorter
|
|
69
|
+
* than any gap between real-world transitions, including Ramadan DST
|
|
70
|
+
* suspensions) and binary-searches each change to the exact instant.
|
|
71
|
+
* @param {string} timezone - Resolved timezone identifier
|
|
72
|
+
* @param {number} fromMs - Range start
|
|
73
|
+
* @param {number} toMs - Range end
|
|
74
|
+
* @returns {number[]} Sorted transition timestamps
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
private _scanTransitions;
|
|
78
|
+
/**
|
|
79
|
+
* Get a cached Intl.DateTimeFormat for a timezone
|
|
80
|
+
* @param {string} timezone - Timezone identifier
|
|
81
|
+
* @returns {Intl.DateTimeFormat}
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
private _getFormatter;
|
|
85
|
+
/**
|
|
86
|
+
* Check if date is in DST for given timezone
|
|
87
|
+
* @param {Date} date - Date to check
|
|
88
|
+
* @param {string} timezone - Timezone identifier
|
|
89
|
+
* @param {Object} [dstRule] - DST rule object (optional, will fetch if not provided)
|
|
90
|
+
* @returns {boolean} True if in DST
|
|
91
|
+
*/
|
|
92
|
+
isDST(date: Date, timezone: string, dstRule?: Object): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Get nth weekday of month
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private getNthWeekdayOfMonth;
|
|
98
|
+
/**
|
|
99
|
+
* Get list of common timezones
|
|
100
|
+
* @returns {Array<{value: string, label: string, offset: string}>}
|
|
101
|
+
*/
|
|
102
|
+
getCommonTimezones(): Array<{
|
|
103
|
+
value: string;
|
|
104
|
+
label: string;
|
|
105
|
+
offset: string;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Format date in specific timezone
|
|
109
|
+
* @param {Date} date - Date to format
|
|
110
|
+
* @param {string} timezone - Timezone for formatting
|
|
111
|
+
* @param {Object} options - Formatting options
|
|
112
|
+
* @returns {string} Formatted date string
|
|
113
|
+
*/
|
|
114
|
+
formatInTimezone(date: Date, timezone: string, options?: Object): string;
|
|
115
|
+
/**
|
|
116
|
+
* Get timezone from browser/system
|
|
117
|
+
* @returns {string} IANA timezone identifier
|
|
118
|
+
*/
|
|
119
|
+
getSystemTimezone(): string;
|
|
120
|
+
/**
|
|
121
|
+
* Parse timezone from string (handles abbreviations)
|
|
122
|
+
* @param {string} tzString - Timezone string
|
|
123
|
+
* @returns {string} IANA timezone identifier
|
|
124
|
+
*/
|
|
125
|
+
parseTimezone(tzString: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* Calculate timezone difference in hours
|
|
128
|
+
* @param {string} timezone1 - First timezone
|
|
129
|
+
* @param {string} timezone2 - Second timezone
|
|
130
|
+
* @param {Date} [date] - Date for DST calculation
|
|
131
|
+
* @returns {number} Hour difference
|
|
132
|
+
*/
|
|
133
|
+
getTimezoneDifference(timezone1: string, timezone2: string, date?: Date): number;
|
|
134
|
+
/**
|
|
135
|
+
* Clear caches (useful when date changes significantly)
|
|
136
|
+
*/
|
|
137
|
+
clearCache(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Validate timezone identifier
|
|
140
|
+
* @param {string} timezone - Timezone to validate
|
|
141
|
+
* @returns {boolean} True if valid
|
|
142
|
+
*/
|
|
143
|
+
isValidTimezone(timezone: string): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Get cache statistics
|
|
146
|
+
* @returns {Object} Cache stats
|
|
147
|
+
*/
|
|
148
|
+
getCacheStats(): Object;
|
|
149
|
+
/**
|
|
150
|
+
* Manage cache size - evict old entries if needed
|
|
151
|
+
* @private
|
|
152
|
+
*/
|
|
153
|
+
private _manageCacheSize;
|
|
154
|
+
}
|