date-fns: Can't resolve 'date-fns/_lib/format/longFormatters'

Code: import DateFnsUtils from '@date-io/date-fns';

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 14
  • Comments: 19 (1 by maintainers)

Most upvoted comments

You probably forgot to install date-fns

yarn add date-fns

or

npm i date-fns

fixed the issue: npm i @date-io/date-fns@1.x date-fns

npm i @date-io/date-fns@1.x date-fns after installing just restart the server only then, this worked

@GDIBass didnt help

Closing as this is

  • not caused by date-fns
  • not further exampled provided

Install the version below instead and run npm start after installation is completed

npm i --save date-fns@next @date-io/date-fns@1.x

import DateFnsUtils from ‘@date-io/date-fns’;

Just add "date-fns": "2.13.0", to your package.json

this didn’t fix the error for me. still receiving RangeError: Format string contains an unescaped latin alphabet character n` error

import DateFnsUtils from ‘@date-io/date-fns’;

Just add "date-fns": "2.13.0", to your package.json

I got the same error after installing latest version: RangeError: Format string contains an unescaped latin alphabet character n (anonymous function) C:/…/node_modules/date-fns/esm/format/index.js:421 418 | } 419 | 420 | if (firstCharacter.match(unescapedLatinCharacterRegExp)) {

421 | throw new RangeError(‘Format string contains an unescaped latin alphabet character ' + firstCharacter + '’); | ^ 422 | } 423 | 424 | return substring;