-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Fixed the meridiem value for Chinese. #222
Conversation
In Chinese, there are more values for the meridiem value than just AM and PM. There are values that mean morning, before noon, noon, afternoon, and night time. I had to modify moment.js to handle a callback or default to the previous behavior.
Hmm, if we're adding I dont think any other languages use |
Are you saying that in all of the other language files, am/AM/pm/PM are all the same? |
Yes, am/pm are the same for all languages but Korean and Chinese. Meridiem was added for the Korean translation, and I didn't know if any future language would need different strings for upper and lower case, hence the semi-redundant am/AM, pm/PM. |
Is it possible to unify the meridiem method into one method? There is no point in having two methods if the only languages that would even use it don't even have uppercase/lowercase. We could delete meridiem am/AM/pm/PM in all other language files and define a meridiem function that accepts |
Yeah, that's probably even better. |
I went ahead and did that, but you don't have to merge that part of the pull request in if you don't want to. I had to change something in the way that languages are added to moment that perhaps changed some functionality. I don't know if it is documented or intentional, but there is the capability for a language definition to inherit from another language definition. Previously, the language definition would inherit from the last language defined. Now it inherits from English. I don't know if this functionality was intentional. When I removed all of the meridiem references it broke the tests with regard to the languages after Korean. Since English is default and is always available I decided that language definition files could inherit from it instead of disabling inheritance altogether. |
The tests pass if we take off inheritance or if we use the English as a fallback. However, I don't know about people's custom language definition files, if indeed there are any. Thoughts? |
Yeah, there's no way to know about people's own language files, but I think we can document the upgrade path and what was depreciated from 1.5 to 1.6. I think inheriting from english is a good idea. It gives the idea of a solid base, unlike how it currently acts, where it depends on the previous language. It will certainly shrink down this file too. https://github.com/timrwood/moment/blob/master/lang/en-gb.js |
The pull request got botched, so I updated everything manually. Can you double check that the Chinese calendar day tests are correct? |
Looks good to me. Do the tests still pass? -rocky
|
Yeah, they pass, but I kinda went about it backwards, copy/pasting the results of the test back into the unit tests themselves. If it all looks good to you, I'll close this out. |
fine by me |
There is a bug in the meridiem function.
When 11:31 am, it should be "中午" (noon), but it becomes "下午" (afternoon).
|
In Chinese, there are more values for the meridiem value than just AM and PM. There are values that mean morning, before noon, noon, afternoon, and night time. I had to modify moment.js to handle a callback or default to the previous behavior.
If you accept #221, I am pretty sure that you will have a merge conflict in the
calendar day
tests. Here is what those tests should look like: