v8-archive
v8-archive copied to clipboard
Bug when use date null
Bug Report
When use calendar or date, setting as nullable, if you leave field empty, you have message : 'Failed generating the SQL query. Statement could not be executed (22007 - 1292 - Incorrect date value: '' for column 'xxxxx' at row 1)
I don't know if this job of api to cast empty string to null value, or of app to send to http://localhost/_/items/my_collec/2?fields=... (PATCH)
{"my_field":""}
instead of
{"my_field":null}
Steps to Reproduce
- Create field of type date
- Leave 'Default Value' empty (null), and 'required' at false
- Create new record with field empty.
Expected Behavior
Save value 'null' in database et and toast ok
Actual Behavior
Display error message and save nothing.
Other Context & Screenshots
Api Error :
{"JSON":{"error":{"code":9,"message":"Failed generating the SQL query. Statement could not be executed (22007 - 1292 - Incorrect date value: '' for column 'fin' at row 1)","query":"UPDATE `autre_tuc` SET `label` = 'Demain', `fin` = '', `id` = '2' WHERE `id` = '2'","class":"Directus\\Database\\Exception\\InvalidQueryException","file":"/var/directus/src/core/Directus/Database/TableGateway/BaseTableGateway.php","line":847}},"Charge utile de la réponse":{"EDITOR_CONFIG":{"text":"{\"error\":{\"code\":9,\"message\":\"Failed generating the SQL query. Statement could not be executed (22007 - 1292 - Incorrect date value: '' for column 'fin' at row 1)\",\"query\":\"UPDATE `autre_tuc` SET `label` = 'Demain', `fin` = '', `id` = '2' WHERE `id` = '2'\",\"class\":\"Directus\\\\Database\\\\Exception\\\\InvalidQueryException\",\"file\":\"\\/var\\/directus\\/src\\/core\\/Directus\\/Database\\/TableGateway\\/BaseTableGateway.php\",\"line\":847}}","mode":"application/json"}}}
The value don't pass by \core\Directus\Database\Schema\Sources\MySQLSchema.php:castValue
Technical Details
- Database: MySQL 5.7
- Directus Release Version:
- App Version: Last (branch master)
- API Version: Last (branch master)
- Install Method: cloned
master
branch
@directus/team — is this API?
Any news on this bug?