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

parseDate returns AM datetime in zh and zh-Hant despite Chinese PM characters #509

Closed
jspeaker opened this issue Sep 12, 2015 · 1 comment · Fixed by #699
Closed

parseDate returns AM datetime in zh and zh-Hant despite Chinese PM characters #509

jspeaker opened this issue Sep 12, 2015 · 1 comment · Fixed by #699

Comments

@jspeaker
Copy link

When evaluating amPm, only "pm" is used to determine if the datetime is in the PM. Because "afternoon" exists in zh and zh-Hant, and the Chinese characters for it are exactly the same as those used for "PM", and it alphabetically comes first, it sets the amPm variable to "afternoon" rather than "pm" and therefore incorrectly does not add 12 hours.

jspeaker added a commit to jspeaker/globalize that referenced this issue Sep 12, 2015
jspeaker added a commit to jspeaker/globalize that referenced this issue Sep 12, 2015
Fixes globalizejs#509
Fixed zh-Hant PM recognition to include 'afternoon' as it alphabetically comes before 'am' - fixes issue where AM and PM were both parsing as the AM datetime because "afternoon" was not being recognized as PM and therefore not adding 12 hours.
omes before 'am' - fixes issue where AM and PM were both parsing as the AM date
jspeaker added a commit to jspeaker/globalize that referenced this issue Sep 12, 2015
Fixes globalizejs#509
Added spaces after and before round braces - fix build.
jspeaker added a commit to jspeaker/globalize that referenced this issue Sep 12, 2015
Fixes globalizejs#509

Fixed zh-Hant PM recognition to include 'afternoon' as it uses the same characters as 'PM' and comes first alphabetically - fixes issue where AM and PM were both parsing as the AM datetime because "afternoon" was not being recognized as PM and therefore not adding 12 hours.
jspeaker added a commit to jspeaker/globalize that referenced this issue Sep 12, 2015
Fixes globalizejs#509

Fixed zh-Hant PM recognition to include 'afternoon' as it uses the same characters as 'PM' and comes first alphabetically.
jspeaker added a commit to jspeaker/globalize that referenced this issue Sep 12, 2015
jspeaker added a commit to jspeaker/globalize that referenced this issue Sep 12, 2015
@rxaviers
Copy link
Member

WIP Fix #508. It misses unit test only.

rxaviers added a commit to rxaviers/globalize that referenced this issue Mar 2, 2017
CLDR introduced additionsl dayPeriods (e.g., morning1, afternoon1,
evening1, etc) along with am and pm. The new dayPeriods should be handle
by "b" and "B" date patterns, while the "a" pattern should still handle
am/pm.

For Chinese, the corresponding value for either pm or afternoon1 is
exactly the same, therefore it causes problem on the reverse lookup when
parsing.

This change fixes the above parsing issue by filtering am/pm only in the
parser properties. It also filters it out on formatting as a simple
optimization (to avoid unnecessary properties).

Fixes globalizejs#509
Closes globalizejs#508
rxaviers added a commit to rxaviers/globalize that referenced this issue Mar 2, 2017
CLDR introduced additional dayPeriods (e.g., morning1, afternoon1,
evening1, etc) along with am and pm. The new dayPeriods should be handle
by "b" and "B" date patterns, while the "a" pattern should still handle
am/pm.

For Chinese, the corresponding value for either pm or afternoon1 is
exactly the same, therefore it causes problem on the reverse lookup when
parsing.

This change fixes the above parsing issue by filtering am/pm only in the
parser properties. It also filters it out on formatting as a simple
optimization (to avoid unnecessary properties).

Fixes globalizejs#509
Closes globalizejs#508
rxaviers added a commit that referenced this issue Mar 10, 2017
CLDR introduced additional dayPeriods (e.g., morning1, afternoon1,
evening1, etc) along with am and pm. The new dayPeriods should be handle
by "b" and "B" date patterns, while the "a" pattern should still handle
am/pm.

For Chinese, the corresponding value for either pm or afternoon1 is
exactly the same, therefore it causes problem on the reverse lookup when
parsing.

This change fixes the above parsing issue by filtering am/pm only in the
parser properties. It also filters it out on formatting as a simple
optimization (to avoid unnecessary properties).

Fixes #509
Closes #508
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants