@forcecalendar/core 2.1.0 → 2.1.2

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.
@@ -138,11 +138,11 @@ export class RecurrenceEngine {
138
138
  if (iterations >= maxIterations) {
139
139
  console.warn('RecurrenceEngine: Invalid byDay rule, falling back to weekly interval');
140
140
  // Reset to original and add weekly interval
141
- next.setDate(originalDate + (7 * rule.interval));
141
+ next.setDate(originalDate + 7 * rule.interval);
142
142
  }
143
143
  } else {
144
144
  // Simple weekly recurrence
145
- next.setDate(next.getDate() + (7 * rule.interval));
145
+ next.setDate(next.getDate() + 7 * rule.interval);
146
146
  }
147
147
  break;
148
148
 
@@ -173,7 +173,7 @@ export class RecurrenceEngine {
173
173
 
174
174
  default:
175
175
  // Unsupported frequency
176
- next.setTime(next.getTime() + (24 * 60 * 60 * 1000)); // Daily fallback
176
+ next.setTime(next.getTime() + 24 * 60 * 60 * 1000); // Daily fallback
177
177
  }
178
178
 
179
179
  return next;
@@ -187,8 +187,13 @@ export class RecurrenceEngine {
187
187
  */
188
188
  static matchesByDay(date, byDay) {
189
189
  const dayMap = {
190
- 'SU': 0, 'MO': 1, 'TU': 2, 'WE': 3,
191
- 'TH': 4, 'FR': 5, 'SA': 6
190
+ SU: 0,
191
+ MO: 1,
192
+ TU: 2,
193
+ WE: 3,
194
+ TH: 4,
195
+ FR: 5,
196
+ SA: 6
192
197
  };
193
198
 
194
199
  const dayOfWeek = date.getDay();
@@ -211,8 +216,13 @@ export class RecurrenceEngine {
211
216
  */
212
217
  static setToWeekdayOfMonth(date, weekday, position = 1) {
213
218
  const dayMap = {
214
- 'SU': 0, 'MO': 1, 'TU': 2, 'WE': 3,
215
- 'TH': 4, 'FR': 5, 'SA': 6
219
+ SU: 0,
220
+ MO: 1,
221
+ TU: 2,
222
+ WE: 3,
223
+ TH: 4,
224
+ FR: 5,
225
+ SA: 6
216
226
  };
217
227
 
218
228
  // Extract weekday code if it has a number prefix
@@ -229,7 +239,7 @@ export class RecurrenceEngine {
229
239
 
230
240
  // Move to the nth occurrence
231
241
  if (position > 1) {
232
- date.setDate(date.getDate() + (7 * (position - 1)));
242
+ date.setDate(date.getDate() + 7 * (position - 1));
233
243
  } else if (position === -1) {
234
244
  // Last occurrence of the month
235
245
  const nextMonth = new Date(date);
@@ -267,11 +277,10 @@ export class RecurrenceEngine {
267
277
  return Math.abs(exceptionDate.getTime() - dateTime) < 1000; // Within 1 second
268
278
  }
269
279
  return exceptionDate.toDateString() === dateStr;
270
- }
271
- // Simple date exception
272
- const exceptionDate = exDate instanceof Date ? exDate : new Date(exDate);
273
- return exceptionDate.toDateString() === dateStr;
274
-
280
+ }
281
+ // Simple date exception
282
+ const exceptionDate = exDate instanceof Date ? exDate : new Date(exDate);
283
+ return exceptionDate.toDateString() === dateStr;
275
284
  });
276
285
  }
277
286
 
@@ -327,9 +336,8 @@ export class RecurrenceEngine {
327
336
 
328
337
  if (dateStr.endsWith('Z')) {
329
338
  return new Date(Date.UTC(year, month, day, hour, minute, second));
330
- }
331
- return new Date(year, month, day, hour, minute, second);
332
-
339
+ }
340
+ return new Date(year, month, day, hour, minute, second);
333
341
  }
334
342
 
335
343
  // Fallback to standard date parsing
@@ -387,9 +395,13 @@ export class RecurrenceEngine {
387
395
  */
388
396
  static getDayName(dayCode) {
389
397
  const dayNames = {
390
- 'SU': 'Sunday', 'MO': 'Monday', 'TU': 'Tuesday',
391
- 'WE': 'Wednesday', 'TH': 'Thursday', 'FR': 'Friday',
392
- 'SA': 'Saturday'
398
+ SU: 'Sunday',
399
+ MO: 'Monday',
400
+ TU: 'Tuesday',
401
+ WE: 'Wednesday',
402
+ TH: 'Thursday',
403
+ FR: 'Friday',
404
+ SA: 'Saturday'
393
405
  };
394
406
 
395
407
  // Extract day code if it has a number prefix
@@ -401,10 +413,10 @@ export class RecurrenceEngine {
401
413
 
402
414
  if (position) {
403
415
  const ordinals = ['', '1st', '2nd', '3rd', '4th', '5th'];
404
- const ordinal = position === -1 ? 'Last' : (ordinals[position] || `${position}th`);
416
+ const ordinal = position === -1 ? 'Last' : ordinals[position] || `${position}th`;
405
417
  name = `${ordinal} ${name}`;
406
418
  }
407
419
 
408
420
  return name;
409
421
  }
410
- }
422
+ }