Closed lefb766 closed 6 years ago
This PR fixes a date format assertion bug or gotcha caused by DateTime::createFromFormat().
DateTime::createFromFormat()
For example, Assertion::date('2018-04', 'Y-m') would throw in May 31 2018. See https://stackoverflow.com/questions/21473817/wrong-month-february-datetimecreatefromformat#21473903.
Assertion::date('2018-04', 'Y-m')
The applied solution was prepending '!' to user specified format before passing it to createFromFormat(). Apparently, it's not a problem if we have duplicated '!' s in a format string.
This PR fixes a date format assertion bug or gotcha caused by
DateTime::createFromFormat()
.For example,
Assertion::date('2018-04', 'Y-m')
would throw in May 31 2018. See https://stackoverflow.com/questions/21473817/wrong-month-february-datetimecreatefromformat#21473903.The applied solution was prepending '!' to user specified format before passing it to createFromFormat(). Apparently, it's not a problem if we have duplicated '!' s in a format string.