JonasWanke / rrule

🔁 Recurrence rule parsing & calculation as defined in the iCalendar RFC
https://pub.dev/packages/rrule
Apache License 2.0
52 stars 22 forks source link

byweekdays feature not working #76

Closed shankarbhattarai123 closed 4 months ago

shankarbhattarai123 commented 5 months ago

When implementing rrule in flutter application byweekdays feature is not working.

JonasWanke commented 4 months ago

Can you please clarify what you mean by not working? Please include some code and explain what you expect it to do.

shankarbhattarai123 commented 4 months ago

`void generateAndScheduleNotifications() { hiveController.retrieveCustomMinute(); DateTime start = convertTimeOfDayToDateTime(startTime).toUtc(); print('Generating daily notifications...$selectedDayNames'); final rule = RecurrenceRule( frequency: Frequency.daily, until: start.add(Duration(days: 730)), byWeekDays: [ ByWeekDayEntry(DateTime.tuesday), ByWeekDayEntry(DateTime.thursday), ]);

final instances = rule
    .getInstances(
        start: DateTime.utc(start.year, start.month, start.day, start.hour,
            start.minute, start.second))
    .toList();

final dates = instances
    .map((instance) =>
        tz.TZDateTime.from(instance, tz.getLocation('Asia/Kathmandu')))
    .toList();
print('daily Dates to schedule: ${dates}');
_scheduleDailyAndMinutelyNotifications(dates);

}` @JonasWanke In above code notification is scheduled for only tuesday and thursday but notification is scheduled for others day also