Skip to content

Commit

Permalink
Fixed #33784 -- Removed unnecessary format escaping in admin calendar…
Browse files Browse the repository at this point in the history
… widget.

Replacements were added in fa0653c
where we created a callback function by concatenating strings. It's
unnecessary and since d638cdc.
  • Loading branch information
ankurr0y authored and felixxm committed Jun 18, 2022
1 parent 8d160f1 commit 3025fc2
Showing 1 changed file with 1 addition and 7 deletions.
Expand Up @@ -387,13 +387,7 @@
DateTimeShortcuts.calendars[num].drawNextMonth();
},
handleCalendarCallback: function(num) {
let format = get_format('DATE_INPUT_FORMATS')[0];
// the format needs to be escaped a little
format = format.replace('\\', '\\\\')
.replace('\r', '\\r')
.replace('\n', '\\n')
.replace('\t', '\\t')
.replace("'", "\\'");
const format = get_format('DATE_INPUT_FORMATS')[0];
return function(y, m, d) {
DateTimeShortcuts.calendarInputs[num].value = new Date(y, m - 1, d).strftime(format);
DateTimeShortcuts.calendarInputs[num].focus();
Expand Down

0 comments on commit 3025fc2

Please sign in to comment.