getFestivals method

List<String> getFestivals()

获取节日,有可能一天会有多个节日 @return 劳动节等

Implementation

List<String> getFestivals() {
  List<String> l = <String>[];
  //获取几月几日对应的节日
  String? f = SolarUtil.FESTIVAL['$_month-$_day'];
  if (null != f) {
    l.add(f);
  }
  //计算几月第几个星期几对应的节日
  int weeks = (_day / 7.0).ceil();
  //星期几,0代表星期天
  int week = getWeek();
  f = SolarUtil.WEEK_FESTIVAL['$_month-$weeks-$week'];
  if (null != f) {
    l.add(f);
  }
  if (_day + 7 > SolarUtil.getDaysOfMonth(_year, _month)) {
    f = SolarUtil.WEEK_FESTIVAL['$_month-0-$week'];
    if (null != f) {
      l.add(f);
    }
  }
  return l;
}