Issue Bug Closed

#110363TCA type=datetime with format=datetime persists seconds that the picker neither shows nor allows to edit

Dennis Bork 08/03/26, 12:23 updated 08/03/26, 13:39

Description

Prerequisites

TYPO3 13.4.31, verified as unchanged on branch 13.4. PHP 8.4.

Steps to reproduce

  1. Edit a page and clear the “Publish date” (starttime) field using the “x” button.
  2. Click the calendar icon. The picker preselects the current date and time; the visible value is formatted Y-m-d H:i, for example 2026-08-03 09:26.
  3. Confirm and save.

Actual result

The persisted timestamp carries the current seconds, for example 09:26:27, while the field only ever displays 09:26. Editors can neither see nor control that part of the value, so the effective moment of publication is not predictable from the form.

Expected result

With format = datetime the persisted value should be normalized to zero seconds.

The picker already distinguishes precision per format — date-time-picker.ts sets enableSeconds: true for timesec and false for date and datetime — and it already normalizes the seconds of the boundaries:

options.minDate.setSeconds(0);
options.maxDate.setSeconds(59);

Only the selected value itself keeps whatever seconds the preselected date happened to carry. A field that offers minute precision in the UI thus persists second precision.

Impact

For starttime and endtime the invisible seconds shift the effective go-live moment by up to 59 seconds relative to the entered value, because the frontend visibility check evaluates a minute-floored access time (DateTimeAspect::get('accessTime')). In combination with the second-precise check in PreviewUriBuilder this also breaks the backend preview — see companion issue #NUMMER.

Field statistics from one production installation: 133 of 2392 pages carrying a starttime have non-zero seconds, uniformly distributed over 1 to 59, while endtime has none at all. That distribution is consistent with the “cleared field, picker preselects now” path and inconsistent with manual entry.

Additional notes

TYPO3 14.1 introduces format=datetimesec (#108431) as an explicit opt-in for second precision. That makes the expectation stated above its natural complement: if second precision is opt-in, format=datetime should not persist seconds silently.

No existing issue for this was found; #108431 adds the opt-in but does not address normalization for format=datetime.

—-
Klick nach dem Einfügen einmal auf „Preview”: Wenn die h2.-Zeilen als Überschriften erscheinen und du nur noch drei bzw. eine Box siehst, sitzt es richtig. Bleiben h2. und die … als Text stehen, läuft euer Forge im Markdown-Modus — dann gebe ich beides in CommonMark aus.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 3

  1. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-08-03T12:49:59+00:00" > 08/03/26, 12:49 </span>

    Thanks for your report. Just to understand the situation better, could you elaborate on why you want to normalize to 0 seconds, if seconds don’t really matter? If the seconds mattered, the `datetimesec` would be the natural choice then, to also control it?

    My reasoning is I wonder if we should try to add logic for these edge cases that always make maintenance a bit harder, and might also introduce bugs. Also, any existing TYPO3 instance saving an existing record might then lead to a changed timestamp of fields like that, which might create issues if the timestamp has been used anywhere.

  2. Dennis Bork commented <span data-processor="relativetime" data-value="2026-08-03T13:14:54+00:00" > 08/03/26, 13:14 </span>

    Thanks for the pushback — it made me look at this again, and I think you’re right that this issue, as filed, isn’t worth the maintenance cost. The actionable part is #110362; I’d suggest closing this one in its favour. Let me answer your questions first, since they explain why #110362 matters.

    Why 0 seconds / why not `datetimesec`

    The seconds aren’t user intent. `starttime`/`endtime` are declared `format = datetime`, and `date-time-picker.js` runs that case with `enableSeconds: false` — seconds are never displayed or editable. They enter through the “Today” shortcut button, whose handler is `onClick: (_, fp) => fp.setDate(new Date, true)`, i.e. the live wall-clock second. Interesting detail: the same `getDateOptions()` already normalizes seconds explicitly for the boundaries (`minDate.setSeconds(0)`, `maxDate.setSeconds(59)`), just not for the value.

    So `datetimesec` wouldn’t help either: the frontend couldn’t honour second precision anyway, because `PageRepository::getDefaultConstraints()` evaluates against `DateTimeAspect::accessTime`, which is floored to 60 s by design (for cache lifetime calculation). Stored seconds don’t add precision — they only push the effective activation to the next minute, so the record goes live up to 59 s after the minute the editor sees in the field.

    Your maintenance and existing-data concerns

    Both are fair, and I’d rather withdraw this than argue for it. Rewriting a user-supplied timestamp inside DataHandler is invasive, and a value silently shifting on the next save of a long-untouched record is exactly the kind of surprise that’s hard to defend. Consider this issue retracted on that basis.

    Why #110362 still stands — and is broader than its title

    That one needs no data migration at all, and while investigating the above I found the preview is broken in both branches whenever `starttime % 60 !== 0`, not just the one I originally described:

    // PreviewUriBuilder::getPreviewUrlParameters(), current v13
    if ($access['starttime'] > $GLOBALS['EXEC_TIME']) {
        $additionalQueryParameters['ADMCMD_simTime'] = $access['starttime'];
    }

    With `starttime = 09:13:21`:

    - At 09:13:45 the condition is false, no `ADMCMD_simTime` is emitted, and the frontend compares `09:13:21 <= accessTime (09:13:00)` → not found → 404. This is what #110362 describes.
    - At 09:12:00 the condition is true and `ADMCMD_simTime = 09:13:21` is emitted — but `PreviewSimulator::simulateDate()` then sets `SIM_ACCESS_TIME = $queryTime – $queryTime % 60 = 09:13:00`, which is again below `starttime` → still 404. This part isn’t covered by the title over there; I’ll add it as a comment.

    So the branch meant to handle exactly this case cannot succeed for any `starttime` carrying seconds, and the preview only starts working at 09:14:00. Rounding the simulated time up to the first minute boundary at which the record is actually live fixes both, and is a behavioural no-op for every record with `seconds = 0` — i.e. everything unaffected today. The `endtime` branch needs no change; flooring `endtime – 1` still lands above the constraint.

    If the display/storage mismatch ever does seem worth closing, the cheapest place is the picker’s “Today” handler (`now.setSeconds(0, 0)` unless `enableSeconds`) — forward-only, no existing record touched. But that’s cosmetic once #110362 is in, so I’m not pursuing it.

  3. Garvin Hicking commented and changed status New Closed <span data-processor="relativetime" data-value="2026-08-03T13:39:59+00:00" > 08/03/26, 13:39 </span>

    Thanks. I’ll make no mistakes and close this issue in favor of #113062 (haven’t thoroughly looked at it, this seems more relevant I agree).