@forcecalendar/core 2.1.49 → 2.1.51

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.
@@ -331,19 +331,19 @@ export class ICSParser {
331
331
  // Check if it's a date-only value
332
332
  if (property.includes('VALUE=DATE') || dateString.length === 8) {
333
333
  // YYYYMMDD format
334
- const year = dateString.substr(0, 4);
335
- const month = dateString.substr(4, 2);
336
- const day = dateString.substr(6, 2);
334
+ const year = dateString.substring(0, 4);
335
+ const month = dateString.substring(4, 6);
336
+ const day = dateString.substring(6, 8);
337
337
  return new Date(year, month - 1, day);
338
338
  }
339
339
 
340
340
  // Full datetime: YYYYMMDDTHHMMSS[Z]
341
- const year = parseInt(dateString.substr(0, 4));
342
- const month = parseInt(dateString.substr(4, 2)) - 1;
343
- const day = parseInt(dateString.substr(6, 2));
344
- const hour = parseInt(dateString.substr(9, 2)) || 0;
345
- const minute = parseInt(dateString.substr(11, 2)) || 0;
346
- const second = parseInt(dateString.substr(13, 2)) || 0;
341
+ const year = parseInt(dateString.substring(0, 4));
342
+ const month = parseInt(dateString.substring(4, 6)) - 1;
343
+ const day = parseInt(dateString.substring(6, 8));
344
+ const hour = parseInt(dateString.substring(9, 11)) || 0;
345
+ const minute = parseInt(dateString.substring(11, 13)) || 0;
346
+ const second = parseInt(dateString.substring(13, 15)) || 0;
347
347
 
348
348
  if (dateString.endsWith('Z')) {
349
349
  // UTC time
@@ -396,14 +396,14 @@ export class ICSParser {
396
396
  let remaining = line;
397
397
 
398
398
  // First line
399
- folded.push(remaining.substr(0, this.maxLineLength));
400
- remaining = remaining.substr(this.maxLineLength);
399
+ folded.push(remaining.substring(0, this.maxLineLength));
400
+ remaining = remaining.substring(this.maxLineLength);
401
401
 
402
402
  // Continuation lines (with space prefix)
403
403
  while (remaining.length > 0) {
404
- const chunk = remaining.substr(0, this.maxLineLength - 1);
404
+ const chunk = remaining.substring(0, this.maxLineLength - 1);
405
405
  folded.push(` ${chunk}`);
406
- remaining = remaining.substr(chunk.length);
406
+ remaining = remaining.substring(chunk.length);
407
407
  }
408
408
 
409
409
  return folded.join('\r\n');
@@ -443,7 +443,7 @@ export class ICSParser {
443
443
  */
444
444
  generateUID() {
445
445
  const timestamp = Date.now().toString(36);
446
- const random = Math.random().toString(36).substr(2, 9);
446
+ const random = Math.random().toString(36).substring(2, 11);
447
447
  return `${timestamp}-${random}@lightning-calendar`;
448
448
  }
449
449
 
@@ -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
- return date >= dstStart || date < dstEnd;
214
+ result = date >= dstStart || date < dstEnd;
215
+ } else {
216
+ result = date >= dstStart && date < dstEnd;
206
217
  }
207
218
 
208
- return date >= dstStart && date < dstEnd;
219
+ // Cache the result
220
+ this.dstCache.set(cacheKey, result);
221
+ this._manageCacheSize();
222
+
223
+ return result;
209
224
  }
210
225
 
211
226
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forcecalendar/core",
3
- "version": "2.1.49",
3
+ "version": "2.1.51",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "A modern, lightweight, framework-agnostic calendar engine optimized for Salesforce",