Bug #99847
closedNull value for time field is ignored in BE
100%
Description
Hi,
Following the example for building a time picker
I've done this:
'start_time' => [
'exclude' => true,
'l10n_mode' => 'exclude',
'l10n_display' => 'defaultAsReadonly',
'label' => 'Start time',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'dbType' => 'time',
'size' => 4,
'disableAgeDisplay' => true,
'eval' => 'time,null',
'default' => null,
],
],
CREATE TABLE tx_myext_domain_model_thing (
start_time time default NULL,
);
and it work fine.
But if the field value in the DB is null the "Set value" checkbox should not be set automatically.
And another thing even if the checkbox for "Set value" is set and the field value in the backend is 00:00 the value in the DB is not changed from null to 00:00
This makes it hard to determine if no value is set or the time is 00:00.
Thanks
Updated by JAKOTA Design Group GmbH almost 2 years ago
One additional note:
The value is only not saved as 00:00 and left null if 00:00 is put in the input field.
If the TimePicker UI is used to set the value the time 00:00 is saved to DB.
Updated by JAKOTA Design Group GmbH almost 2 years ago
- Complexity set to no-brainer
I've found the reason why this is not working.
/typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseRowDateTimeFields.php
always sets the value to 0 if it is null and also is not returning the correct timestamp for 00:00.
Line: 49 to 51 is:
} else {
$result['databaseRow'][$column] = $format['reset'] ?? null;
}
but should/could be:
} else if ($result['databaseRow'][$column] === ($format['empty'] ?? null)) {
$result['databaseRow'][$column] = date('c', 0);
} else if (null !== $result['databaseRow'][$column]) {
$result['databaseRow'][$column] = ($format['reset'] ?? null) === null ? null : date('c', (int)$format['reset']);
}
This solves both issues.
I'm not sure why the first "if" checks for an format empty
&& $result['databaseRow'][$column] !== ($format['empty'] ?? null)
Cause even that needs to be converted to something like 1970-01-01T00:00:00+00:00 otherwise this value gets set back to null the next time the record is saved.
If someone could have a look please.
Thanks.
Updated by Gerrit Code Review over 1 year ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by JAKOTA Design Group GmbH over 1 year ago
- Related to Bug #97216: Time value "midnight" (00:00) is not accepted added
- Related to Bug #98252: TCA Default value for times cannot be set added
Updated by Gerrit Code Review over 1 year ago
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78168
Updated by Gerrit Code Review over 1 year ago
Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Sebastien Convers over 1 year ago
- Related to Bug #100649: Extbase DataMapper doesn't respect datetime when 0 or 0000-00-00 or 0000-00-00 00:00:00 or 00:00:00 added
Updated by JAKOTA Design Group GmbH over 1 year ago
- Related to Bug #92900: Unable to store "epoch start" on native datetime fields with dbtype added
Updated by Gerrit Code Review over 1 year ago
Patch set 2 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78168
Updated by Gerrit Code Review over 1 year ago
Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 11 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 12 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 13 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 14 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 15 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78096
Updated by Gerrit Code Review over 1 year ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79748
Updated by Gerrit Code Review over 1 year ago
Patch set 3 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78168
Updated by Gerrit Code Review over 1 year ago
Patch set 4 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78168
Updated by JAKOTA Design Group GmbH over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 288b82a2f99809eb092f08d094bdfe5c417ca128.
Updated by Gerrit Code Review over 1 year ago
- Status changed from Resolved to Under Review
Patch set 5 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78168
Updated by Gerrit Code Review over 1 year ago
Patch set 6 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78168
Updated by Gerrit Code Review over 1 year ago
Patch set 7 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78168
Updated by Gerrit Code Review over 1 year ago
Patch set 8 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78168
Updated by Gerrit Code Review over 1 year ago
Patch set 9 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78168
Updated by JAKOTA Design Group GmbH over 1 year ago
- Status changed from Under Review to Resolved
Applied in changeset ee732584daf85435204852279d8d0a54614337ea.