#109819Backend datetime picker renders broken calendar grid when dateTimeFirstDayOfWeek is unset in uc
Description
Summary
After Feature #108463 (“User-specific configuration of date-timepicker’s first day of a week”, introduced in 14.1), the backend date-time picker renders a broken calendar grid for any backend user whose be_users.uc does not contain a dateTimeFirstDayOfWeek entry — which is the default state for every user that hasn’t opened the User Settings module since the upgrade.
In the broken state, the calendar lays the days out sequentially starting in the leftmost column: the 1st of every month appears in column 0, the 2nd in column 1, etc., regardless of the actual weekday. The week header is rendered correctly, so the misalignment is immediately visible (e.g. December 1st 2026 is shown under “Sun” although it is a Tuesday).
Affected versions
- TYPO3 >= 14.1 (since Feature #108463 — User-specific configuration of date-timepicker’s first day of a week)
Steps to reproduce
- On a clean 14.x install (or an upgraded site), use a BE user whose
ucdoes not yet containdateTimeFirstDayOfWeek. The simplest way: create a fresh BE user and log in once. - Open any record with a TCA
type=datetimefield. - Open the picker and navigate between months.
Expected
The 1st of each month is rendered in the column matching its actual weekday (e.g. Dec 1 2026 in the Tuesday column, Feb 1 2026 in the Sunday column).
Actual
The 1st of every month appears in column 0 (“Sun” with ‘en’ locale). Days 2..N fill the remaining cells sequentially. The previous-month padding cells are absent entirely.
Root cause
typo3/sysext/backend/Resources/Public/JavaScript/storage/persistent.js returns undefined (not "") when a key is missing from uc — see the deep-key lookup in getRecursiveDataByDeepKey() and the dedicated isset() helper which checks for both undefined and null.
typo3/sysext/backend/Build/Sources/TypeScript/backend/date-time-picker.ts (lines 64-75) only guards against the empty string:
const dow = Persistent.get('dateTimeFirstDayOfWeek');
if (dow !== '') {
const dowNumber = parseInt(dow, 10) - 1;
flatpickr.l10ns[locale].firstDayOfWeek = dowNumber;
flatpickr.l10ns.default.firstDayOfWeek = dowNumber;
}
With dow === undefined, the branch executes, parseInt(undefined, 10) - 1 evaluates to NaN, and firstDayOfWeek is assigned NaN.
In flatpickr’s buildDays() the leading-day offset is then (date.getDay() - NaN + 7) % 7 === NaN, so the prev-month padding loop for (var u = o + 1 - NaN; u <= o; ...) never executes and days are appended into a grid with no leading offset.
Proposed fix
Tighten the guard to also reject undefined / null:
const dow = Persistent.get('dateTimeFirstDayOfWeek');
if (dow !== '' && dow !== undefined && dow !== null) {
const dowNumber = parseInt(dow, 10) - 1;
flatpickr.l10ns[locale].firstDayOfWeek = dowNumber;
flatpickr.l10ns.default.firstDayOfWeek = dowNumber;
}
Workaround
For an upgraded site: set a system-wide override in User TSConfig until users have populated their preferences:
setup.override.dateTimeFirstDayOfWeek = 2
Note: setup.default.* is insufficient because that only applies to users who have never logged in.
Reviews 2
History 26
-
Gerrit Code Review pushed patch set 1 for main to change 94073 status
NewUnder Review <span data-processor="relativetime" data-value="2026-05-12T06:34:50+00:00" > 05/12/26, 06:34 </span> -
Gerrit Code Review pushed patch set 2 for main to change 94073 <span data-processor="relativetime" data-value="2026-05-12T07:09:43+00:00" > 05/12/26, 07:09 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 94073 <span data-processor="relativetime" data-value="2026-05-12T07:37:52+00:00" > 05/12/26, 07:37 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 94075 <span data-processor="relativetime" data-value="2026-05-12T08:44:34+00:00" > 05/12/26, 08:44 </span>
-
Garvin Hicking commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-05-12T09:05:11+00:00" > 05/12/26, 09:05 </span> -
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-08-11T08:50:43+00:00" > 08/11/26, 08:50 </span>
Applied in changeset commit:df991295544a71331872f9146e9459776a1aca7c.