any-date-parser icon indicating copy to clipboard operation
any-date-parser copied to clipboard

Invalid: Unable to parse (some non-english locales)

Open alexamoralessmyth opened this issue 2 years ago • 0 comments

Hello -

I am attempting to implement the 'any-date-parser' in my typescript project. It seems that some locales are causing errors in the .fromString function. Below is an example of my implementation:

node v18.7 typescript v4.7.3

const parser = require('any-date-parser');
const value = new Date(Date.UTC(1955, 10, 5));
const formattedDate = new Intl.DateTimeFormat(new Intl.DateTimeFormat('ja-JP', { dateStyle: 'full'},).format(value);
return parser.fromString(formattedDate, 'ja-JP`);

error:

 {"invalid": "Unable to parse 1955年11月5日土曜日"}

Please let me know if further information is needed. Thanks!

alexamoralessmyth avatar Sep 21 '22 14:09 alexamoralessmyth