I am running version 2.2.1, and look at the following output from the node REPL:
> const format = require('date-fns').format
undefined
> format(new Date(), 'EEEE')
'2222'
> format(new Date(), 'cccc LLLL do yyyy')
'cccc LLLL 2nd yyyy'
> format(new Date(), 'EEEE MMMM do YYYY')
'2222 September 2nd 2019'
> format(new Date(), 'EEEE MMMM do YYYY', { locale: 'en-US'})
'2222 September 2nd 2019'
Am I missing something totally from the docs, or what on earth could be causing this?
So to add to this, if I start up a completely different project, and install date-fns, formatting works. So there must be some kind of conflict in my node_modules.
Does anyone have any idea what could cause this?
I'm having the same issue. Works with v1 in my project, but I've tried 2.2.1 and 2.1.0 so far, and format doesn't work correctly in either.
format(0, 'dd')
// should be 'Su', but is '31' instead.
@fkabinoff I found my problem. Basically one of my other deps was installing an older version of date-fns, and there was a collision. I wiped my node_modules and re-installed, and now things are working as expected.
Most helpful comment
@fkabinoff I found my problem. Basically one of my other deps was installing an older version of date-fns, and there was a collision. I wiped my node_modules and re-installed, and now things are working as expected.