#111420Admin Panel: "Simulate time" date/time fields show 1970-01-01 00:00 when no simulation is set
Description
Steps to reproduce
- Enable the admin panel (
config.admPanel = 1, user TSconfigadmPanel.enable.preview = 1). - Log in to the backend and open a frontend page.
- Open the admin panel, open the “Preview” settings. No time simulation is active (checkbox “Simulate time” unchecked).
Expected
The (disabled) date and time fields are empty.
Actual
The date field shows 01/01/1970 and the time field 00:00.
If the user ticks “Simulate time” and saves without changing the date, the result depends on the browser timezone. In a browser east of UTC (e.g. Europe/Berlin) the fields are parsed as local time, which gives a negative timestamp (-3600). PreviewModule clamps it via max($simulateDate, 60), so the frontend is rendered at 1970-01-01 00:01 UTC. All records with a starttime disappear, which is confusing. In a browser running in UTC the value becomes 0 and no simulation happens at all.
Cause
Without a simulation, PreviewModule::getPageSettings() passes (int)($this->config['simulateDate'] ?? 0), i.e. 0, to the template. Partials/Form/DateTime.fluid.html renders it into the hidden field:
<input type="hidden" name="TSFE_ADMIN_PANEL[{name}]" id="{name}" value="{value}" />
Build/Sources/TypeScript/adminpanel/modules/preview.ts only checks whether the hidden field has a value. The string “0” is truthy, so it initialises the pickers with the Unix epoch:
if (this.targetField.value) {
const initialDate = new Date(parseInt(this.targetField.value, 10) * 1000);
this.dateField.valueAsDate = initialDate;
this.timeField.valueAsDate = initialDate;
}
Possible fix
Treat 0 as “no value”, e.g. in preview.ts:
const initialTimestamp = parseInt(this.targetField.value, 10);
if (initialTimestamp > 0) {
...
}
or render an empty value in the partial: value="{f:if(condition: value, then: value)}".
Environment
- Reproduced with TYPO3 13.4.39 (Composer mode), PHP 8.4.
- The code is unchanged on main (v14).
- Related, but a different issue: #101849 (simulated time does not respect the timezone).
valueAsDateinterprets the timestamp as UTC, whileupdateDateField()parses the entered values as local time.
Reviews 1
History 12
-
Maike Kiebele changed assigned to Maike Kiebele <span data-processor="relativetime" data-value="2026-11-13T07:41:22+00:00" > 11/13/26, 07:41 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 97598 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-13T09:05:37+00:00" > 11/13/26, 09:05 </span>