formatjs / dust-intl

Dust helpers for internationalization.
http://formatjs.io/dust/
Other
48 stars 11 forks source link

Test for `intlDate` is failing #18

Closed fhemberger closed 10 years ago

fhemberger commented 10 years ago
Helper `intlDate` should return a formatted string (date):

      expected: "1/23/2014"
      actual: "1/24/2014"

I did a quick check: This bug is not related to the intl polyfill in node, this works for me:

var Intl=require('intl');
var date = new Date('Thu Jan 23 2014 18:00:44 GMT-0500 (EST)');
console.log( new Intl.DateTimeFormat('en-US').format(date) );

In consequence, the test for intlMessage (with date) is broken as well, this time the month is changed from January to April:

Helper `intlMessage` should return a formatted string with formatted numbers and dates:

      expected: "Atlanta has a population of 5,475,213 as of Jan 1, 2010."
      actual: "Atlanta has a population of 5,475,213 as of April 1, 2010."
caridy commented 10 years ago

ok, I will look into this asap.

caridy commented 10 years ago

After some investigation, this is happening due to the latest update in Intl polyfill (0.1.3),. which was released 6 hours ago. If you force to install 0.1.2, the issue goes away. The correct code to test this is:

var Intl=require('intl');
var date = new Date('Thu Jan 23 2014 18:00:44 GMT-0500 (EST)');
console.log( new Intl.DateTimeFormat('en-US', { month: 'short', day: 'numeric', year: 'numeric' }).format(date) );

the output will be:

// for intl@0.1.2: Jan 23, 2014 
// for intl@0.1.3: April 23, 2014

This might a regression related to https://github.com/andyearnshaw/Intl.js/issues/65

caridy commented 10 years ago

closing this. you can use the proper version of the polyfill, and we can track the progress directly on the intl repo.