Skip to content

Instantly share code, notes, and snippets.

@ldmsys
Last active August 18, 2021 13:00
Show Gist options
  • Save ldmsys/7b16ac5e1d1bafa53852104c741465ff to your computer and use it in GitHub Desktop.
Save ldmsys/7b16ac5e1d1bafa53852104c741465ff to your computer and use it in GitHub Desktop.
Get Sexagenary Cycle(간지), which is commonly used in East Asia
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