Open henriquemoody opened 5 months ago
This is caused by a combination of two non-intuitive behaviors of DateTime::createFromFormat
:
This means that DateTime::createFromFormat('Ym', '202302')
will use the current day of the month, e.g. the parsed date will be 2023-02-31 on January 31st. The overflow behavior "corrects" this to 2023-03-03.
Prefixing the format string with "!" will set missing fields to sensible, fixed default values (i.e. 1 for the day).
Thank you for such detailed answer, @reima!
Hello @henriquemoody !
Could you please provide status on this issue? I believe in 2.3.7 bug were still present?
Thanks, Anna
This is probably an issue with PHP, not with the library itself. I can't wrap my head around it:
I will create a commit to let the test pass for now, and I will get back to it whenever I can.
Another similar issue: https://github.com/henriquemoody/Validation/actions/runs/8103265516/job/22147529888