I have a field with a 'date' type. If I input "2013-00-00" as a date, it is translated to "2012-11-30" which is PHP's design of the strtotime function.
However, 2013-00-00 is a valid SQL date, and I need to keep it that way.
I tracked it down to Database.php line 1201.
Same problem goes with fields of type 'timestamp'. If I input a timestamp (an integer), in a timestamp field, the formatter makes it go through the strtotime function which does not understand integers and outputs 0000-00-00 in the SQL update.
Temporary fix: change the date type to a string type in my model schema.
check for the format of the inputted value before passing it through the formatter? I don't think the value should go through the formatter if the format of the value is already correct.
Try (object) "2013-00-00".
Further testing ... I have a field that's called 'date_creation' and it's default value in maria DB is 'CURRENT_TIMESTAMP'.
When saving a new object to the database, date_creation is translated to '0000-00-00'. The same line is the culprit I think.
The same problem is happening to me, have you found any way to solve it? Thanks :)
The workaroud exposed in #776 should work.
I think this is related to #855. Please review.
Closed in flavor of #858.