To convert all the dates from us-format into swiss-format, I use a custom JS. But using that code, breaks the Editor (not Design-mode, only Editor-mode; eg I can no longer add a new Item to a cms-collection… Editor just does not react on clicking on the add-button):
$(document).ready(function() {
$.getScript('https://aarg-musikverband.s3.amazonaws.com/js/date.js', function() {
$('div.dateus').each(function() {
var d = $(this);
var dOrg = d.text();
var dParsed = Date.parse(dOrg);
$.getScript('https://aarg-musikverband.s3.amazonaws.com/js/date-de-DE.js', function() {
var dLong = dOrg;
if (d.hasClass('datum-lang')) {
var dLong = dParsed.toString('d. MMMM yyyy');
} else if (d.hasClass('datum-wochentag')) {
var dLong = dParsed.toString('dddd, d. MMMM yyyy');
}
d.text(dLong);
});
});
});
})
Can anyone help me to fix this code, so that Editor still works?