luxon: toFormat() does not work with i18n and fails on Node.js
Trying in Node.js with the following (this is the documentation example):
DateTime.fromISO('2014-08-06T13:07:04.054').setLocale('fr').toFormat('yyyy LLL dd');
I get the result: "null Aug null"
.
The Node app runs on a server in UK (which has not brexited yet đ and rather than the French âaou.â for month I get the English âAugâ. Moreover day (dd) and year (yyyy) miserably fail đ
Luckily, the toLocalString works. But I need to handle various user format.
See screen shot.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 23 (6 by maintainers)
I was experiencing the same error when running my code using Firebase cloud functions. Upgrading my firebase functions from Node 6 to Node 8 fixed it for me.
@matthiasg thanks a lot for claryfying. The polyfill is indeed not needed. - My personal issue is closed thereby.
One more thing: I guess my observation still hits people in environments where the polyfill IS NEEDED. Whatâs you opinion?
Greetings from Karlsruhe
In order to have Node.js process international formats:
full-icu
as a dependencynode_modules/full-icu
)Letâs separate a few things out here:
formatToParts
and thus canât do Intl parsing and formatting whether or not it has access to the ICU data. Thatâs just how it is. You can see that documented here.@PierreKauffmann the only thing I can think of is to make super extra sure youâre really running the version of Node you think you are. Can you checkprobably not the problemprocess.version
in the same process youâre testing Luxon?