Heavenly Stems (天干) and Earthly Branches (地支) calculations. Used for year/month/day pillars in traditional Chinese timekeeping.
Get the 60-cycle index (1-60) from a GanZhi pair
Uses the Chinese Remainder Theorem to find the unique position in the 60-term sexagenary cycle.
The GanZhi pair
Position in the cycle (1-60), where 1 = 甲子
ganZhiToCycleIndex({ gan: 0, zhi: 0 }) // 1 (甲子)ganZhiToCycleIndex({ gan: 9, zhi: 11 }) // 60 (癸亥) Copy
ganZhiToCycleIndex({ gan: 0, zhi: 0 }) // 1 (甲子)ganZhiToCycleIndex({ gan: 9, zhi: 11 }) // 60 (癸亥)
Heavenly Stems (天干) and Earthly Branches (地支) calculations. Used for year/month/day pillars in traditional Chinese timekeeping.