Mootools Datepicker d.m.y #7831
Comments
Changing the date format in the System Settings is not recommended in general. If you want to change the frontend output, you should do that in the page root settings. |
Yes, but this is about data maintenance in the backend. And even if it isn't recommended, I don't think a feature, which has been around for years, should break other features. |
The date picker requires the year with 4 numbers as far as I remember. You have to use |
Then the date picker is faulty, because it states Mootools More as a dependency and the More/Date can definitely parse german dates. https://jsfiddle.net/jvase62t/ Imho there is a bug somewhere - not in Contao though. |
Datepicker uses MooTools Date.parse() function. This parses a date from a string and can only work correct if the appropriate Locale is loaded and the parsers are defined correctly. But even this will be faulty as long as we have the choice to set back end language format as we like e.g. m.y.d In Contao we don't load the Locales. We use en-US with all languages and define it according to the back end language. // back end language de
Locale.define("en-US", "Date", {
months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
days: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
months_abbr: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
days_abbr: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]
});
Locale.define("en-US", "DatePicker", {
select_a_time: "Uhrzeit auswählen",
use_mouse_wheel: "Ändern Sie die Werte mit Hilfe des Mausrads",
time_confirm_button: "OK",
apply_range: "Anwenden",
cancel: "Abbrechen",
week: "W"
}); Additionaly the parsers in the Contao MooTools more are patched. Look at your fiddle example - it's not correct. You want april as month but it is january. We can do some things to repair back end JS date from string parsing. (this is an OR list)
I think this has to be discussed. IMHO setting one parser on the fly with appropriate dateOrder setting or using only UTC will work. |
When setting the backend date format to "d.m.y" the datepicker will show 1970 instead of the actual value.
Tested on the demo.
Reproducible:
Logging into the backend, going to Settings and changing date format to "d.m.y" and try to change the default value (not empty) of an datepicker field.
The text was updated successfully, but these errors were encountered: