getNineStar method

NineStar getNineStar()

Implementation

NineStar getNineStar() {
  int index = LunarYear.fromYear(_year).getZhiIndex() % 3;
  int m = _month.abs();
  int monthZhiIndex = (13 + m) % 12;
  int n = 27 - (index * 3);
  if (monthZhiIndex < LunarUtil.BASE_MONTH_ZHI_INDEX) {
    n -= 3;
  }
  int offset = (n - monthZhiIndex) % 9;
  return NineStar.fromIndex(offset);
}