I have a form that contains the following input:
<div class="form-group col-md-6 ">
<label for="startdate">Start date</label>
<input class="form-control" name="startdate" type="date" id="startdate">
</div>
I know the expected format for the backend to get a date value is yyyy-mm-dd (The HTML5 date input specification refers to the RFC3339 specification, which specifies a full-date format equal to: yyyy-mm-dd).
However it appears that Internet Explorer 11 sends the value in a different format because I get an error and the following message in my Laravel logs (using Laravel 5.8):
[2019-12-03 20:41:16] production.ERROR: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '06/12/2019' for column 'startdate' at row 1 (SQL: insert into `absenses` (`motive`, `startdate`
at /var/www/zitthy/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 22007): SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '06/12/2019' for column 'startdate'
at row 1 at /var/www/zitthy/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:123, PDOException(code: 22007): SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '06/12/2019' for column 'startdate'
at row 1 at /var/www/zitthy/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:121)
This works normally in Chrome and Firefox.
Any tips on how to fix this in IE11?
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire