Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: auThursday eptember 28 12:00 PM parsed as Sat Oct 07 2023 12:00:00 #537

Open
tiny-dancer opened this issue Oct 7, 2023 · 2 comments

Comments

@tiny-dancer
Copy link

tiny-dancer commented Oct 7, 2023

I've started using chrono node to help with post processing ocr. When running the following code on October 7:

parsedDateTime = chrono.parseDate(
          `auThursday eptember 28 12:00 PM`
        );
console.log(`Parsed Date: ${parsedDateTime}`);

Outputs: Parsed Date: Sat Oct 07 2023 12:00:00 GMT-0500 (Central Daylight Time)

It appears reasonable for chrono node to parse auThursday eptember 28 12:00 PM as indeed September 28 12:00.

  • October 7 is a saturday, not a thursday
  • eptember 28 is a closer match to September 28 than October 7

Are my expectations reasonable for chrono-node? Are there further configurations that would help improve the parsing results?

Asking these questions to gauge if i need to use spellcheckers ahead of chrono-node or if it reasonable for chrono-node to handle fuzzy matching similar to this example

Thanks!

@tiny-dancer tiny-dancer changed the title Question: auThursday eptember 28 12:00 PM parsed as 2023-10-06 12:00:00 Question: auThursday eptember 28 12:00 PM parsed as Sat Oct 07 2023 12:00:00 Oct 7, 2023
@tiny-dancer
Copy link
Author

tiny-dancer commented Oct 7, 2023

Another result for reference and if this is inline with expectations (executed on October 7):

parsedDateTime = chrono.parseDate(
         'Thursday eptember 28 12:00 PM'
        );

console.log(`Parsed Date: ${parsedDateTime}`);
Parsed Date: Thu Oct 05 2023 12:00:00 GMT-0500 (Central Daylight Time)

@wanasit
Copy link
Owner

wanasit commented Nov 11, 2023

Hello. Thanks for letting me know about your use case.

It is an interesting problem, but I am afraid it would be difficult to make Chrono handle spellchecking.

--

One idea you could try is populating Chrono dictionary (e.g. locales/en/constants.ts) with the common misspelled words (e.g. "September" => "eptember", "Sptember", "Setember", "Sepember", ...).

Because Chrono doesn't make those expose its dictionary to API, you probably need to fork and modify the library.

--

Sorry that I cannot really help you much on this.
Please let me know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants