I am migrating from moment to date-fns and following docs on the official site.
I have installed date-fns from npm and when I try to use I get this error:
TypeError: format is not a function
I have tried import, require but they all give same error.
var format = require('date-fns/format')
import format from 'date-fns/format'
Also the typeof(format) returns undefined.
Using v1.29.0 on Nodejs
From the doc.
import { format } from 'date-fns';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With