computeSolarTerm method

List<PWBSolarTermModel> computeSolarTerm(
  1. int month
)

Implementation

List<PWBSolarTermModel> computeSolarTerm(int month) {
  List<PWBSolarTermModel> result = [];
  for (int n = (month * 2 - 1); n <= month * 2; n++) {
    double termDays = term(theDate.year, n, true);
    int mdays = antiDayDifference(theDate.year, termDays.toInt());
    int termDay = mdays % 100;
    int hour = (tail(termDays) * 24).toInt();
    int minute = ((tail(termDays) * 24 - hour) * 60).toInt();

    DateTime termDate = DateTime(
        theDate.year, theDate.month, termDay, hour, minute);

    if (n < 3) {
      result.add(PWBSolarTermModel(
          PWBSolarTermModel.solarterms()[n + 21], termDate));
    } else {
      PWBSolarTermModel model =
          PWBSolarTermModel(PWBSolarTermModel.solarterms()[n - 3], termDate);
      result.add(model);
    }
  }
  return result;
}