@forcecalendar/core 2.1.49 → 2.1.50
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.
|
@@ -179,6 +179,14 @@ export class TimezoneManager {
|
|
|
179
179
|
* @returns {boolean} True if in DST
|
|
180
180
|
*/
|
|
181
181
|
isDST(date, timezone, dstRule = null) {
|
|
182
|
+
// Check cache first
|
|
183
|
+
const cacheKey = `${timezone}_${date.getFullYear()}_${date.getMonth()}_${date.getDate()}_${date.getHours()}`;
|
|
184
|
+
if (this.dstCache.has(cacheKey)) {
|
|
185
|
+
this.cacheHits++;
|
|
186
|
+
return this.dstCache.get(cacheKey);
|
|
187
|
+
}
|
|
188
|
+
this.cacheMisses++;
|
|
189
|
+
|
|
182
190
|
// Get DST rule if not provided
|
|
183
191
|
if (!dstRule) {
|
|
184
192
|
const tzData = this.database.getTimezone(timezone);
|
|
@@ -201,11 +209,18 @@ export class TimezoneManager {
|
|
|
201
209
|
);
|
|
202
210
|
|
|
203
211
|
// Handle Southern Hemisphere (DST crosses year boundary)
|
|
212
|
+
let result;
|
|
204
213
|
if (dstStart > dstEnd) {
|
|
205
|
-
|
|
214
|
+
result = date >= dstStart || date < dstEnd;
|
|
215
|
+
} else {
|
|
216
|
+
result = date >= dstStart && date < dstEnd;
|
|
206
217
|
}
|
|
207
218
|
|
|
208
|
-
|
|
219
|
+
// Cache the result
|
|
220
|
+
this.dstCache.set(cacheKey, result);
|
|
221
|
+
this._manageCacheSize();
|
|
222
|
+
|
|
223
|
+
return result;
|
|
209
224
|
}
|
|
210
225
|
|
|
211
226
|
/**
|