@forcecalendar/core 2.1.39 → 2.1.41
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.
|
@@ -304,10 +304,20 @@ export class RecurrenceEngineV2 {
|
|
|
304
304
|
} else if (rule.byDay && rule.byDay.length > 0) {
|
|
305
305
|
// Nth weekday of month (e.g., "2nd Tuesday")
|
|
306
306
|
const byDay = rule.byDay[0];
|
|
307
|
-
|
|
307
|
+
let weekday, nthOccurrence;
|
|
308
|
+
|
|
309
|
+
if (typeof byDay === 'string') {
|
|
310
|
+
// Parse string format from RRuleParser: "MO", "2TU", "-1FR"
|
|
311
|
+
const match = byDay.match(/^(-?\d*)([A-Z]{2})$/);
|
|
312
|
+
weekday = match ? match[2] : byDay;
|
|
313
|
+
nthOccurrence = match && match[1] ? parseInt(match[1], 10) : 1;
|
|
314
|
+
} else {
|
|
315
|
+
weekday = byDay.weekday;
|
|
316
|
+
nthOccurrence = byDay.nth || 1;
|
|
317
|
+
}
|
|
308
318
|
|
|
309
319
|
next.setMonth(next.getMonth() + rule.interval);
|
|
310
|
-
this.setToNthWeekdayOfMonth(next,
|
|
320
|
+
this.setToNthWeekdayOfMonth(next, weekday, nthOccurrence);
|
|
311
321
|
} else if (rule.bySetPos && rule.bySetPos.length > 0) {
|
|
312
322
|
// BYSETPOS for selecting from set
|
|
313
323
|
next.setMonth(next.getMonth() + rule.interval);
|
|
@@ -358,11 +358,18 @@ export class EventSearch {
|
|
|
358
358
|
if (normalizedValue.includes(term)) {
|
|
359
359
|
totalScore += 10;
|
|
360
360
|
}
|
|
361
|
-
// Fuzzy match if enabled
|
|
361
|
+
// Fuzzy match if enabled — compare against individual words
|
|
362
362
|
else if (fuzzy) {
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
363
|
+
const words = normalizedValue.split(/\s+/);
|
|
364
|
+
let bestDistance = Infinity;
|
|
365
|
+
for (const word of words) {
|
|
366
|
+
const distance = this.levenshteinDistance(term, word);
|
|
367
|
+
if (distance < bestDistance) {
|
|
368
|
+
bestDistance = distance;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (bestDistance <= 2) {
|
|
372
|
+
totalScore += 5 - bestDistance;
|
|
366
373
|
}
|
|
367
374
|
}
|
|
368
375
|
}
|