Last active
August 18, 2021 13:00
-
-
Save ldmsys/7b16ac5e1d1bafa53852104c741465ff to your computer and use it in GitHub Desktop.
Get Sexagenary Cycle(간지), which is commonly used in East Asia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSexagenary(year) { | |
let stems = "경신임계갑을병정무기"; | |
let branches = "신유술해자축인묘진사오미"; | |
return stems[year % 10] + branches[year % 12]; | |
} | |
// getSexagenary(1592) == "임진", getSexagenary(1919) == "기미", getSexagenary(2016) == "병신" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment