wanasit / chrono

A natural language date parser in Javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

de locale in parse function

q16marvin opened this issue · comments

Hi,

i try something like this:

const chronoedAll = chrono.de.parse( cmd, { instant: new Date(), timezone: -getUTCOffset(new Date(), findTimeZone(timezone)).offset, }, { forwardDate: true, } ); if (chronoedAll[1]) console.log(Found multiple dates in ${cmd}, chronoedAll);

but than i to got this:

src/command.ts(49,7): error TS2345: Argument of type '{ instant: Date; timezone: number; }' is not assignable to parameter of type 'Date'. Object literal may only specify known properties, and 'instant' does not exist in type 'Date'.

without locale it is working, but i want to test it with "de". what i do wrong?

forget it, im stupid

Hello. Thanks for letting me know.

Those locale-specific shortcut functions' Typescript interface are outdated. I updated them in fa472f2. After the update, you should be able to call chrono.de.parse(..., {instant: ...}) as in chrono.parse().