Hi Rick,
Thanks for the quick response!
On Wed Nov 30 21:28:23 2016, rick@measham.id.au wrote:
Show quoted text> Hi Erik,
>
> While I no longer maintain this module, I can tell you that it wasn't
> designed for guessing the format, but for parsing dates when you know
> the format.
Yes. I'm aware of that. However, ...
Show quoted text> If you give the date as 82910-04-13566 and format of %d-%m-%Y then is
> will looks for \d\d-\d\d-\d\d\d\d and find it. You told it that that
> was the format of the date you were passing in.
This is *exactly* what I call guessing the format. Because the input does not exactly match the pattern, yet you're not failing to generate a date.
So, my point is not that I expect '2016-11-30' to be parsed. My point is that, when the format '%d-%m-%y' is used, the input should be *rejected* as it is not a valid date of the format '\d\d-\d\d-\d\d'. Anything else would be guessing the format and/or guessing the input's intentions.
Show quoted text> While it could include negative look-behinds and negative look-aheads
> to
> make sure the previous or next character wasn't a digit, the point of
> the module isn't to validate a string against a number of patterns.
No, but wouldn't you say that you're now also matching 'yesterday, 16-11-30'? Which isn't exactly date parsing, but rather date extracting? I want to use the module to parse dates according to a format and reject the input when it doesn't match.
To be honest, I am highly surprised that the module introduction mentions something about date-guessing, but it doesn't mention that it'll accept '2222222-15-11111' as a valid date for e.g. a '\d\d-\d\d-\d\d' pattern.
I hope the maintainers consider this a bug!
Regards,
Erik.