getSpecialFestival method

String getSpecialFestival(
  1. int year,
  2. int month,
  3. int day
)

获取特殊计算方式的节日 如:每年五月的第二个星期日为母亲节,六月的第三个星期日为父亲节 每年11月第四个星期四定为"感恩节"

@param year year @param month month @param day day @return 获取西方节日

Implementation

static String getSpecialFestival(int year, int month, int day) {
  if (!SPECIAL_FESTIVAL.containsKey(year)) {
    SPECIAL_FESTIVAL.addAll({year: getSpecialFestivals(year)});
  }
  List<String> specialFestivals = SPECIAL_FESTIVAL[year];
  String text = "$year" + getString(month, day);
  String solar = "";
  for (String special in specialFestivals) {
    if (special.contains(text)) {
      solar = special.replaceAll(text, "");
      break;
    }
  }
  return solar;
}