getGanZhi method

String getGanZhi()

Implementation

String getGanZhi() {
  int yearGanIndex = 0;
  IndexValue? iv = LunarUtil.find(_liuNian.getGanZhi(), LunarUtil.GAN);
  if (null != iv) {
    yearGanIndex = iv.getIndex() - 1;
  }
  int offset = [2, 4, 6, 8, 0][yearGanIndex % 5];
  String gan = LunarUtil.GAN[(_index + offset) % 10 + 1];
  String zhi = LunarUtil.ZHI[(_index + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12 + 1];
  return gan + zhi;
}