Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reign names calculator off by one year #2080

Open
wdgml opened this issue Nov 4, 2024 · 15 comments · May be fixed by #2093
Open

reign names calculator off by one year #2080

wdgml opened this issue Nov 4, 2024 · 15 comments · May be fixed by #2093

Comments

@wdgml
Copy link

wdgml commented Nov 4, 2024

Hovering over 安政二年, for example, gives "1856," but it should be "1855." It seems to be adding one extra year to the results (presumably adding 2 to the first year of the reign period; but only 1 should be added, since counting begins at 1, not 0). The same problem occurs for many, but not all, other reign periods.

@birtles
Copy link
Member

birtles commented Nov 6, 2024

Hi! Thanks for reporting this. I had a quick look into it and I think the issue is more complicated than that. Our era data says 安政 started in 1855:

['安政', { reading: 'あんせい', start: 1855, yomi: 'Ansei' }],

Which, strictly speaking it did:

嘉永から安政への改元が行なわれたのはグレゴリオ暦1855年1月15日であり、和暦が新年を迎えないうちに西暦だけが新年を迎えている期間であった。安政元年は西暦1855年1月15日から同2月16日までの短い期間であるため、和暦と西暦を一対一で対応させようとする場合、嘉永7年=安政元年=西暦1854年、安政2年=西暦1855年となって実際とはずれが生じる。

As I understand it, before about 1873 when the Japanese calendar 旧暦 was aligned with the Gregorian calendar, Western years and Japanese years didn't strictly line up. So 安政 started in January 1855 in the Gregorian calendar but 安政2年 is also (mostly) 1855. Then there's the phenomenon where a new era is retroactively applied back to the start of the year which I guess would mean it started in 1854 in some sense.

I think handling this properly would be quite a bit more work but would probably be worthwhile to do.

@SaltfishAmi
Copy link
Contributor

SaltfishAmi commented Nov 6, 2024 via email

@birtles
Copy link
Member

birtles commented Nov 6, 2024

I'm thinking the minimum would be two probable years (e.g. 安政2年 = 1855~1856, maybe even with the dates).

If we actually had a full date 安政2年1月16日 then it would be nice if we could actually translate that to a specific year, but I don't think that's strictly necessary.

@enellis
Copy link
Contributor

enellis commented Nov 6, 2024

Here is a very good and detailed explanation for an accurate date conversion.

I would be willing to give this a try, including converting all dates prior to 1873 to their corresponding Gregorian equivalents.

@wdgml
Copy link
Author

wdgml commented Nov 6, 2024

You are all very much correct that it is a complicated issue, as the lunar years and solar years do not align, and occasionally a new reign period starts in the gap between the solar new year and the lunar new year. For precise dates (with a month and day), the year can be determined using conversion charts or online conversion tools. Where only a year is given, though, the usual custom in the field (here I am speaking as a professional Japan historian) is to use the generally corresponding Western year. So Ansei 1 would still be 1854, even if this is a bit odd from a strictly logical perspective. In any event, Ansei 2 would definitely be in 1855 (leaving aside the fact that for certain dates at the end of Ansei 2, after the solar new year, it was technically 1856 in the West). I'm attaching a conversion chart I created for the Edo period, just to illustrate this more clearly and completely. Perhaps you could use a ≈ symbol for years if the incommensurability is a concern? As for converting more precise dates, that seems beyond the expectations of a pop-up dictionary, and people can easily refer to online conversion tools. Thank you for your hard work on such an invaluable tool!
Edo_nenpyo

@SaltfishAmi
Copy link
Contributor

SaltfishAmi commented Nov 6, 2024 via email

@enellis
Copy link
Contributor

enellis commented Nov 9, 2024

I kinda agree with the idea that day-to-day conversion is unnecessary (remember that Gregorian calendar starts from the 1580s, which is another deeeeeeeeep rabbit hole).

That will always be a problem, though, even when just displaying the time span of one year. Using proleptic Gregorian dates for all dates would be the simplest solution for that.

I've started working on this branch, and I've already implemented a way to display the time span as you suggested:
Bildschirmfoto 2024-11-09 um 01 44 07
(For years from 1873 / 明治6年, it falls back to the current way of displaying, e.g. 令和元年 = 2019年.)

With the dataset I gathered, converting every date to a Gregorian date will also be very straightforward.

@SaltfishAmi
Copy link
Contributor

SaltfishAmi commented Nov 9, 2024 via email

@enellis
Copy link
Contributor

enellis commented Nov 9, 2024

  1. How about making the day and month part smaller font size than the year part, or have dimmer color? I'm not sure about this, just an 思い付き.

That's a great idea. I haven't really thought about the design yet, as I wanted to implement the logic first. The day-to-day conversion should be styled differently as well, I think.

  1. When displaying full date, PLEASE DO allow custom format or use the format from system or browser locale. PLEASE NEVER hardcode dMy.

It's currently using the toLocaleDateString()method from Date, so it should be in the browser's locale, but we can still think about allowing more customization.

@Tomalak
Copy link

Tomalak commented Nov 9, 2024

Since most modern software conflates the concepts of „UI language“ and „locale“, toLocaleDateString() gives me undesirable outputs in all browsers I use. Being able to override the default behavior could be useful.

@birtles
Copy link
Member

birtles commented Nov 11, 2024

I've started working on this branch, and I've already implemented a way to display the time span as you suggested:

Thanks looks great.

I agree that doing a suitable localized date is tricky (for some users it might even end up being identical to the original date!) but I wonder if we could just always use YYYY.MM.DD? I think that's unambiguous and since we want to emphasize the year, putting it first makes the information easier to scan—particularly if we end up making the month and date smaller as @SaltfishAmi suggested.

@enellis
Copy link
Contributor

enellis commented Nov 11, 2024

I wonder if we could just always use YYYY.MM.DD?

How about using YYYY年MM月DD日?

@birtles
Copy link
Member

birtles commented Nov 11, 2024

I wonder if we could just always use YYYY.MM.DD?

How about using YYYY年MM月DD日?

Yes, I think that would work too. (I find it a little harder to scan but at least it's unambiguous. Presumably anyone looking up years would know enough kanji to decipher that much, and if not, they can hover over the individual kanji anyway.)

@enellis
Copy link
Contributor

enellis commented Nov 11, 2024

This is the current state:

Bildschirmfoto 2024-11-11 um 21 12 00
Year only.

Bildschirmfoto 2024-11-11 um 21 13 53
With month.

Bildschirmfoto 2024-11-11 um 21 14 16
Full date.

Can't really say that I'm fully satisfied. Any thoughts or ideas?

EDIT:

Bildschirmfoto 2024-11-11 um 21 59 46
Dimmer color.

@birtles
Copy link
Member

birtles commented Nov 12, 2024

Looks great to me!

@enellis enellis linked a pull request Nov 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants