monthlyJalali static method

Future<bool> monthlyJalali(
  1. UNotificationRequest request, {
  2. required int day,
  3. required int hour,
  4. int minute = 0,
})

Every Jalali month on day at hour:minute; short months fall back to their last day. UNotification.monthlyJalali(req, day: 1, hour: 9)

Implementation

static Future<bool> monthlyJalali(UNotificationRequest request, {required int day, required int hour, int minute = 0}) {
  if (day < 1 || day > 31) throw ArgumentError.value(day, "day", "must be 1-31");
  // Anchor on the latest month that has [day]; later, shorter months clamp to their last day.
  final UJalali now = UJalali.now();
  int year = now.year;
  int month = now.month;
  while (UJalali(year, month).monthLength < day) {
    month--;
    if (month == 0) {
      month = 12;
      year--;
    }
  }
  return UNotifyChannel.schedule(request, UJalali(year, month, day, hour, minute).toDateTime(), repeat: URepeat.monthly, calendar: URepeatCalendar.persian);
}