Last active
August 20, 2022 10:42
-
-
Save tadd/cb4276e57fbf21fa4dd3bba453c4285e to your computer and use it in GitHub Desktop.
大化の改新が二回起こる件について(蘇我入鹿は二度死ぬ)
This file contains hidden or 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
const [lsyear, lslong] = [{year: 'numeric'}, {dateStyle: 'long'}].map(o => | |
d => d && d.toLocaleString("ja-JP-u-ca-japanese", o)); | |
const isolong = d => d && d.toISOString().slice(0, "yyyy-mm-dd".length); | |
const d = new Date(643, 0, 1); | |
let prevy, prevd; | |
for (let i = 0; i < 1300; i++) { | |
//console.debug(lslong(d)); | |
const y = lsyear(d); | |
if (y !== prevy) { | |
const l = [prevd, d].map(d => `${lslong(d)} (${isolong(d)})`); | |
console.log(l.join(' -> ')); | |
prevy = y; | |
} | |
prevd = new Date(d); // clone | |
d.setDate(d.getDate() + 1); | |
} |
This file contains hidden or 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
# node -v #=> v18.7.0 | |
undefined (undefined) -> 大化-2年12月29日 (0642-12-31) | |
大化-2年12月31日 (0643-01-02) -> 大化元年1月1日 (0643-01-03) | |
大化元年12月31日 (0644-01-02) -> 大化0年1月1日 (0644-01-03) | |
大化0年12月31日 (0645-01-02) -> 大化元年1月1日 (0645-01-03) | |
大化元年12月31日 (0646-01-02) -> 大化2年1月1日 (0646-01-03) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment