You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error is in src/iteration/date_set_filtering.dart
Beginning from line 64 (_isFilteredByWeekDays);
if (rrule.frequency == Frequency.yearly && rrule.byMonths.isEmpty)
-> I think byMonths can be deleted here as this seems to be the reason. It works fine without it.
But I am not sure if there is a specific reason?
You can also test with below:
voidmain() {
group('instancesAndRruleToRruleString', () {
test('yearly every second Tuesday of January (for 4 years)', () {
final rrule =RecurrenceRule(
frequency:Frequency.yearly,
count:4,
interval:1,
byMonths: {1},
byWeekDays: {ByWeekDayEntry(DateTime.tuesday, 2)});
final rruleString = rrule.toString();
print('RRULE_STRING: $rruleString');
final instances = rrule.getAllInstances(start:DateTime.now().toUtc());
print('RRULE_INSTANCES: $instances');
expect(rruleString,
'RRULE:FREQ=YEARLY;COUNT=4;INTERVAL=1;BYDAY=2TU;BYMONTH=1');
});
});
}
The text was updated successfully, but these errors were encountered:
GoldenSoju
changed the title
getting instances for rrule yearly, 'every 2nd tuesday of January
getting instances for rrule yearly, 'every 2nd tuesday of January' fails
Jan 3, 2022
Thanks for all the details and the reproduction test! It turns out that the second part of the condition (rrule.byMonths.isEmpty) is relevant, but I forgot to handle the other case:
With the frequency set to yearly, something like 2TU means the second Tuesday of the year. However, when byMonths/BYMONTH is also specified (e.g., 1,4), 2TU means the second Tuesday of any of the specified months (e.g., the second Tuesday of January and the second Tuesday of April).
I fixed this in 8646af1 which is published as part of v0.2.4.
When requesting all instances for Rrule
'RRULE:FREQ=YEARLY;COUNT=4;INTERVAL=1;BYDAY=2TU;BYMONTH=1'
,it fails with error message:
However, it seems to be a legit rrule. (Tested also with (https://jakubroztocil.github.io/rrule/) )
Error is in src/iteration/date_set_filtering.dart
Beginning from line 64 (
_isFilteredByWeekDays
);if (rrule.frequency == Frequency.yearly && rrule.byMonths.isEmpty)
-> I think byMonths can be deleted here as this seems to be the reason. It works fine without it.
But I am not sure if there is a specific reason?
You can also test with below:
The text was updated successfully, but these errors were encountered: