peachpie
peachpie copied to clipboard
Fix strtotime
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?
I was checking the issue down to the actual time parser.
-
The tokens like "first", "monday", etc. are parsed at
Generators/StrToTime.lex(generated intoParsers\StrToTimeScanner.cs). Seems the parser does not know the "of" token at all. -
"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