getTraditionFestival method

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

返回传统农历节日

@param year 农历年 @param month 农历月 @param day 农历日 @return 返回传统农历节日

Implementation

static String getTraditionFestival(int year, int month, int day) {
  if (month == 12) {
    int count = daysInLunarMonth(year, month);
    if (day == count) {
      return TRADITION_FESTIVAL_STR[0]; //除夕
    }
  }
  String text = getString(month, day);
  String festivalStr = "";
  for (String festival in TRADITION_FESTIVAL_STR) {
    if (festival.contains(text)) {
      festivalStr = festival.replaceAll(text, "");
      break;
    }
  }
  return festivalStr;
}