question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dates() fails to parse "next week"

See original GitHub issue

dates() fails to parse "next week" properly. It parses it but does not create a date for this.

This library can parse dates well (as does your spacetime library) including next week. https://github.com/wanasit/chrono

Thank you for creating this library. I appreciate your work.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
spencermountaincommented, Feb 10, 2020

thanks Taylor, I’ve always seen date-parsing as the most important thing that compromise should do. I agree with your examples. Right now this library is in ‘quality denial’ stage, but changing this is a priority for me this year, and in the next few months. Help is of course welcome @thegoatherder .

Maybe it’s corny, but i’m particularly excited about having a lot of tests - even though they aren’t passing. Maybe one thing that would be helpful is to add a huge number of exhaustive tests - that’s the only way this thing is going to ever be good.

You mentioned week-startings - we’re using spacetime which supports configuring the start of the week, so that should be easy to do.

ya - the current config options are timezone, and today. But we should support british-endian preference, and week-starting preference immediately.

0reactions
spencermountaincommented, Jul 26, 2022

cleaning up old issues, these appear to work now:

console.log(nlp(`next week`).dates().json())
console.log(nlp(`We'll have to catch up some time next week`).dates().json())// - 2020-02-10 to 2020-02-16 (week starts on monday according to ISO8601)
console.log(nlp(`Roadworks will take place in May 2020`).dates().json()) //- 2020-05-01 to 2020-05-31
console.log(nlp(`Coming to cinemas in 2021`).dates().json())  //- 2021-01-01 to 2020-12-31

cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does Date.parse give incorrect results? - Stack Overflow
Until the 5th edition spec came out, the Date.parse method was completely implementation dependent ( new Date(string) is equivalent to ...
Read more >
dateparser not able to parse things like next tuesday. #573
It parses Tuesday to the date of the Tuesday of the current week but when input is next Tuesday it returns none.
Read more >
User friendly date-time parsing functions - lubridate
parse_date_time() parses an input vector into POSIXct date-time object. ... This might result in All formats failed to parse error. See notes below....
Read more >
Datetime Patterns for Formatting and Parsing - Apache Spark
Exactly 4 pattern letters will use the full text form, typically the full description, e.g, day-of-week Monday might output “Monday”. 5 or more...
Read more >
lubridate parsing dates automatically - Jenny Richmond
I've been looking at old Tidy Tuesday datasets this week to try and work out why sometimes date data is automatically parsed as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found