Issue Bug Closed

#96556Record edit emits a JavaScript warning (error) in the console when trying to initilize a DateTimePicker field, when backenduser has default language/coredev unset language in userconfiguration (BE_USER->uc)

Stefan Bürk 01/17/22, 01:05 updated 07/06/23, 14:35

Description

Can be easyli reproduced:

1. make new/empty install with monorepo/coredev main branch
2. activate styleguide -> install both installsets
3. open webbrowser javascript console
4. Navigate to Page module -> select styleguide frontend -> menu_sitemap
5. Edit content element record on this page (context menu -> edit )
6. Following warning shows up in the webbroser development console:

flatpickr.min.js?bust=b6528527ab614a375b93e0eb912708fba2a41881:2 Error: flatpickr: invalid locale undefined
    at re (flatpickr.min.js?bust=b6528527ab614a375b93e0eb912708fba2a41881:2:25491)
    at flatpickr.min.js?bust=b6528527ab614a375b93e0eb912708fba2a41881:2:38570
    at y (flatpickr.min.js?bust=b6528527ab614a375b93e0eb912708fba2a41881:2:47971)
    at x (flatpickr.min.js?bust=b6528527ab614a375b93e0eb912708fba2a41881:2:48258)
    at E (flatpickr.min.js?bust=b6528527ab614a375b93e0eb912708fba2a41881:2:48707)
    at o.initializeField (DateTimePicker.js?bust=b6528527ab614a375b93e0eb912708fba2a41881:13:1577)
    at DateTimePicker.js?bust=b6528527ab614a375b93e0eb912708fba2a41881:13:1360

Also see attached image:

typo3-be-datetime-picker-error.png

This should be fixed in two steps:

1. ensure JavaScript do not emits warning and additional fallback to default userlocale as with empty language key (instead of undefined which leads to this error).
2. Ensure on the server side for the ajax endpint which loads the userconfig that alwas a language key is added, even if not saved yed (at best directly return default language / en instead of empty)

Point 2 should be addressed in a follow up / dedicated patch, this issue/patch addresses the first one.

Could only reproduce this on main, not in 11.5 and not tested lower ….

Reviews 1