getSolarTerm method

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

返回24节气

@param year 年 @param month 月 @param day 日 @return 返回24节气

Implementation

static String getSolarTerm(int year, int month, int day) {
  if (!SOLAR_TERMS.containsKey(year)) {
    SOLAR_TERMS.addAll({year: SolarTermUtil.getSolarTerms(year)});
  }
  List<String> solarTerm = SOLAR_TERMS[year];
  String text = "${year}" + getString(month, day);
  String solar = "";
  for (String solarTermName in solarTerm) {
    if (solarTermName.contains(text)) {
      solar = solarTermName.replaceAll(text, "");
      break;
    }
  }
  return solar;
}