@JeroenVanOort Before it would be doing this and casting the obj to string so the setToStringFormat would be used.
$attributes[$key] = (string) $this->asDateTime($attributes[$key]);
but it now does this and runs it through serializeDate() which is basically doing ->format('Y-m-d H:i:s') on the date.
$attributes[$key] = $this->serializeDate($this->asDateTime($attributes[$key]));
I can't see why it was changed due to default __toString being 'Y-m-d H:i:s', makes no sense to me.
const DEFAULT_TO_STRING_FORMAT = 'Y-m-d H:i:s';
Here's the commit that changed how it worked.
https://github.com/laravel/framework/commit/fd5e1a7026d88e27794f2db08b788944421275a3
Dates are now serialized using the date format specified via overriding getDateFormat or new $dateFormat property. This provides a more intuitive way of serializing dates, and should match what a new user would expect. Also added new serializeDate() for more granular control over serialization, and to make it easy to store dates in one format while serializing them into arrays and JSON as a separate format.
@TaylorOtwell The last statement on serializeDate() "granular control" doesn't seem to be true as it's using the same dateFormat as how it's stored. If you changed the it through setDateFormat on the model it'll throw a wobbler as soon as it gets to createFromFormat and it doesn't match the value (as it's mixing the usage for format and with creating from format).
return $model->setDateFormat('Y-m'); // fail
(new DateTime('2015-07-02 00:00:00'))->format('Y-m'); // fine
DateTime::createFromFormat('Y-m', '2015-07-02 00:00:00'); // nope