Repository navigation
Support Short Japanese Era Name #5698
Description
Activity
@eternalharvest Could you take a look at this issue please?
Sorry, I didn't noticed there is inconsistentency between document description and the implementation.
As @anaskiee mentioned, it seems document description is wrong.
In current version, there is no feature to format short era name (single Kanji character).Correct Description of Current Implementation
Input LibreOffice Examples (en) Example (ja) Description N,NN,NNN G AD R Abbr Era name n/a GG ? 令 Short Era name (not implemented) NNNN GGG Anno Domini 令和 Full Era name NNNNN n/a AD ㋿ Narrow Era name I confirmed that Excel has same implementation with LibreOffice.
I think there is no narrow era name feature in LibreOffice and Excel, so I choosed 'NNNNN' as narrow era name.I think I need to write a PR for fix the wrong document descritpion.
And also need to improve the feature format era name like below.
In Japan, short era name is first Kanji character of era name, but it may need to consider about implementation whether if we need to add new 'Short era name' mapping field or not.Improved Version (candidate)
Input LibreOffice Examples (en) Example (ja) Description N G AD R Abbr Era name NN GG ? 令 Short Era name NNN,NNNN GGG Anno Domini 令和 Full Era name NNNNN n/a AD ㋿ Narrow Era name Please tell me any opinion/advice if you have any idea to improve the formatting token.
Reacted by Simon Rey and Heinmci@eternalharvest Your Improved Version looks good to me.
Hi, thanks for this request.
See https://momentjs.com/docs/#/-project-status/ - we will not be adding new features. But perhaps this is simple enough to add.
I updated the docs myself.
Reacted by anaskiee, Simon Rey and Takuya SawadaHi, I was hoping to contribute, but I think this issue seems to have been fixed. Please confirm. Thanks!
@qqweng
The issue was closed but not fixed. The project moment.js is now a legacy and only mandatory updates are going to be pushed. See https://momentjs.com/docs/#/-project-status/For information, to workaround the issue, I replaced the text 令 (when not followed by 和) by 令和. That's independant of moment.js because the text is replaced before calling moment()
If this change is simple, you can make a pull request and I can look at it. But I cannot promise we will merge it.
Hi,
To put a little bit of context, japanese dates can be written using the imperial calendar. The current Japanese era is Reiwa. It is written 令和 and can be abbreviated 令 or R. For instance 令和2年1月1日 which stands for january 1st of the 2th year of 令和 era, can also be abbreviated 令2年1月1日 or R2.1.1
Since moment 2.25, it is possible to extract japanese dates using era notation.
But, it is not possible to parse "令2年1月1日", because there is no token for this abbreviation. Tokens N, NN and NNN are all linked to the property eraAbbr which is R for the current japanese Reiwa era. And NNNN is for 令和.
By the way, the documentation does not describe the current implementation.
https://momentjs.com/docs/#/parsing/string-format/
It is written
The documentation description would be great.
That also would correlate to the LibreOffice tokens
Thanks