formatjs / handlebars-intl

Handlebars helpers for internationalization.
http://formatjs.io/handlebars/
Other
265 stars 28 forks source link

`Thu Jan 01 00:00:00 UTC 1970` is interpreted as falsy value and throw #47

Closed caridy closed 9 years ago

caridy commented 9 years ago

https://github.com/yahoo/handlebars-intl/blob/master/src/helpers.js#L197-L202

> new Date('Thu Jan 01 00:00:01 UTC 1970').getTime()
1000
> new Date('Thu Jan 01 00:00:00 UTC 1970').getTime()
0
>

since the value is 0, it is a falsy value and we don't have a way to differentiate it with:

> new Date(0).getTime()
0
caridy commented 9 years ago

related to https://github.com/yahoo/intl-relativeformat/issues/5 and affects react-intl, and dust-intl as well.