Skip to content

1.3-rc0 fractional seconds nor milliseconds working for date skeletons #753

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

Closed
mattyork opened this issue Jun 30, 2017 · 10 comments
Closed

Comments

@mattyork
Copy link
Contributor

1.3-rc is looking good, but this is blocking us right now.

Repro!

const ianaTzData = require('iana-tz-data');
const Globalize = require("globalize");
const cldrData = require('./vendor/cldr-data.json');
Globalize.loadTimeZone(ianaTzData);
Globalize.load(cldrData);
Globalize.locale("en");

const date = new Date();
const d1 = Globalize.dateFormatter({ skeleton: "yyyyMMddjjmmssSSS" })
console.log(d1(date))
const d2 = Globalize.dateFormatter({ skeleton: "yyyyMMddjjmmssAAA" })
console.log(d2(date))

Expected to see fractional seconds and milliseconds according to this: http://www.unicode.org/reports/tr35/tr35-dates.html#dfst-second

Actual Output:

D:\gitlab\localize> node .\test.js
06/30/2017, 02:00:00037 PM
06/30/2017
@rxaviers
Copy link
Member

rxaviers commented Jun 30, 2017

Hi! Thanks for submitting this issue. In addition to your description, follow what ICU returns for comparison: https://ssl.icu-project.org/icu4jweb/flexTest.jsp?pat=yyyyMMddjjmmssSSS&_=en_US

For instance, "06/30/2017, 2:03:17.423 PM" for en-US.

@rxaviers
Copy link
Member

The existing skeleton expand-pattern algorithm doesn't handle S. 😩

It should implement the following:

A requested skeleton that includes both seconds and fractional seconds (e.g. “mmssSSS”) is allowed to match a dateFormatItem skeleton that includes seconds but not fractional seconds (e.g. “ms”). In this case the requested sequence of ‘S’ characters (or its length) should be retained separately and used when adjusting the pattern, as described below.
...
If the requested skeleton included both seconds and fractional seconds and the dateFormatItem skeleton included seconds but not fractional seconds, then the seconds field of the corresponding pattern should be adjusted by appending the locale’s decimal separator, followed by the sequence of ‘S’ characters from the requested skeleton.

http://www.unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons

@rxaviers
Copy link
Member

Would you like to work on that?

@mattyork
Copy link
Contributor Author

mattyork commented Aug 3, 2017

PR sent!

@rxaviers
Copy link
Member

rxaviers commented Aug 3, 2017

Awesome!

mattyork added a commit to mattyork/globalize that referenced this issue Aug 14, 2017
mattyork added a commit to mattyork/globalize that referenced this issue Aug 16, 2017
@jhaverhals
Copy link

In which release can I expect the fix for this issue?

@sigalvo
Copy link

sigalvo commented Dec 14, 2017

Hi,
Are there any news on this fix?

@rxaviers
Copy link
Member

The delay merging and releasing this is on my side, but it will happen this month 🙈

@sigalvo
Copy link

sigalvo commented Dec 17, 2017

Great! thanks

@jhaverhals
Copy link

Is there something you could share already?

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

No branches or pull requests

4 participants