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

strftime extension for East Asian dates #147

Open
opoudjis opened this issue Dec 25, 2024 · 0 comments
Open

strftime extension for East Asian dates #147

opoudjis opened this issue Dec 25, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@opoudjis
Copy link
Contributor

From #138

@ronaldtse:

Eventually we should allow the customization of dates just like how we do numbers now. Liquid has also a “date” command that allows reformatting of dates, and we can take heed from that and strftime.

Me:

strftime alternates between different forms of notation with quite arbitrary use of flags: %y as two-digit year, %Y as four-digit year, %B as name of month, %b as truncated name of month, %m, as zero-padded month digit, %-m as unpadded month digit. Specifying a Roman numeral for month (which is Continental European practice), or Japanese instead of Arabic numerals for date numbers, is going to take a lot more than strftime out of the box. twitter-cldr-rb also seems to have gone in a wrong-headedly inflexible direction with date specification. (I can't even tell if twitter-cldr-rb supports Roman numeral months at all.)

https://metacpan.org/pod/POSIX::strftime::GNU

I see "alternative numeric symbols" are allowed through the modifiers O and E: %0m is an alternative numeric symbol for a month (which can be a Roman numeral, as confirmed in https://manpages.ubuntu.com/manpages/focal/man3/strftime.3.html ), and %EY is a locale-dependent representation of the year (which might be the regnal year—but which doesn't give us the alternation between numeric and Kanji regnal years).

https://pubs.opengroup.org/onlinepubs/7908799/xsh/strftime.html

Reading that, %Ey is an offest from a base year %EC, and that implies a regnal year (per https://stat.ethz.ch/R-manual/R-devel/library/base/html/strptime.html, E stands for "era", e.g. different religious calendar); but that spec still doesn't give numeric vs Kanji regnal year: %Oy is defined as offset from %C, in other words two-digit year in the century.

strftime is going to need a lot of extending to cope with East Asian dates, and we should try to find out whether anything of the sort has been attempted in East Asia.

I see twitter-cldr is based loosely on the Unicode CLDR values for dates:

https://unicode-org.github.io/icu/userguide/format_parse/datetime/

https://www.unicode.org/reports/tr35/tr35-dates.html#Contents

In that spec, the regnal year is covered as G for the emperor and y for the year; but the CLDR spec does not allow alternation between different numbering systems at all. CLDR seems to be hardcoded to Arabic numerals, including notions of significant digits, and will need to be extended if we want it to alternate between Roman, Arabic, and Chinese numerals.

@opoudjis opoudjis added the enhancement New feature or request label Dec 25, 2024
@opoudjis opoudjis self-assigned this Dec 25, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in Metanorma Dec 25, 2024
@opoudjis opoudjis moved this from 🆕 New to 🏕 Med priority in Metanorma Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🏕 Med priority
Development

No branches or pull requests

1 participant