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

Fix strtotime #840

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Indigo744
Copy link
Contributor

@Indigo744 Indigo744 commented Sep 1, 2020

strtotime fails with

  • strtotime("first monday of 2020-01")

And has wrong result for:

  • strtotime("2020-01")

I only added the test cases for now, but I have no idea how to tackle this. Any pointers?

@jakubmisek
Copy link
Member

I was checking the issue down to the actual time parser.

  1. The tokens like "first", "monday", etc. are parsed at Generators/StrToTime.lex (generated into Parsers\StrToTimeScanner.cs). Seems the parser does not know the "of" token at all.

  2. "2020-01" is also an unknown combination in the parser, it expects three numbers, not just two.

So it is possible to update the parser (StrToTime.lex) with the new "grammar". Technically it is just a lexer, so it's very simple pattern matching

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

Successfully merging this pull request may close these issues.

2 participants