| 33 | } |
| 34 | |
| 35 | export class RRule { |
| 36 | static WEEKLY = Frequency.WEEKLY; |
| 37 | static DAILY = Frequency.DAILY; |
| 38 | static MONTHLY = Frequency.MONTHLY; |
| 39 | static YEARLY = Frequency.YEARLY; |
| 40 | static HOURLY = Frequency.HOURLY; |
| 41 | static MINUTELY = Frequency.MINUTELY; |
| 42 | static SECONDLY = Frequency.SECONDLY; |
| 43 | |
| 44 | static MO = Weekday.MO; |
| 45 | static TU = Weekday.TU; |
| 46 | static WE = Weekday.WE; |
| 47 | static TH = Weekday.TH; |
| 48 | static FR = Weekday.FR; |
| 49 | static SA = Weekday.SA; |
| 50 | static SU = Weekday.SU; |
| 51 | |
| 52 | public options: any; |
| 53 | |
| 54 | constructor(options: any = {}) { |
| 55 | this.options = options; |
| 56 | } |
| 57 | |
| 58 | get origOptions() { |
| 59 | return this.options; |
| 60 | } |
| 61 | |
| 62 | between(start: Date, end: Date, inclusive: boolean = false): Date[] { |
| 63 | // Mock implementation that generates dates based on the recurrence rule |
| 64 | const dates: Date[] = []; |
| 65 | |
| 66 | if (!this.options || !this.options.dtstart) { |
| 67 | return dates; |
| 68 | } |
| 69 | |
| 70 | const { freq, byweekday, dtstart } = this.options; |
| 71 | |
| 72 | if (freq === Frequency.WEEKLY && byweekday && byweekday.length > 0) { |
| 73 | // For weekly recurrence, generate dates that match the specified weekdays |
| 74 | const current = new Date(start); |
| 75 | current.setUTCHours(0, 0, 0, 0); |
| 76 | |
| 77 | while (current <= end) { |
| 78 | const dayOfWeek = current.getUTCDay(); |
| 79 | |
| 80 | // Check if this day matches any of the specified weekdays |
| 81 | const matchesWeekday = byweekday.some((wd: any) => { |
| 82 | const targetDay = wd.weekday !== undefined ? wd.weekday : wd; |
| 83 | // Convert Sunday=0 to Sunday=6 for our comparison |
| 84 | const adjustedDayOfWeek = dayOfWeek === 0 ? 6 : dayOfWeek - 1; |
| 85 | return targetDay === adjustedDayOfWeek; |
| 86 | }); |
| 87 | |
| 88 | if (matchesWeekday && current >= start) { |
| 89 | dates.push(new Date(current)); |
| 90 | } |
| 91 | |
| 92 | current.setUTCDate(current.getUTCDate() + 1); |
nothing calls this directly
no outgoing calls
no test coverage detected