Craft CMS (thankfully) stores all dates/times in the DB in the UTC timezone. The current master branch currently 1) expires collisions based on the Craft system timezone, and 2) does not actually pass a time to the MnSnitchRecord::model()->deleteAll() call, it only uses a YYYY-mm-dd formatted representation.
Passing a \Craft\DateTime object as a query binding causes \Craft\DateTime::__toString() to be called by the ORM, which returns the date in YYYY-mm-dd format. So collisions will not expire until the next day, since the time is not part of that string.
This patch uses the DateTimeHelper::formatTimeForDb() method to give us the proper DB engine formatted date/time string, in the UTC timezone.
Craft CMS (thankfully) stores all dates/times in the DB in the UTC timezone. The current
master
branch currently 1) expires collisions based on the Craft system timezone, and 2) does not actually pass a time to theMnSnitchRecord::model()->deleteAll()
call, it only uses aYYYY-mm-dd
formatted representation.Passing a
\Craft\DateTime
object as a query binding causes\Craft\DateTime::__toString()
to be called by the ORM, which returns the date inYYYY-mm-dd
format. So collisions will not expire until the next day, since the time is not part of that string.This patch uses the
DateTimeHelper::formatTimeForDb()
method to give us the proper DB engine formatted date/time string, in the UTC timezone.Tested on
Craft CMS 2.6.2903
.