0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Fixed #33784 -- Removed unnecessary format escaping in admin calendar widget.

Replacements were added in fa0653cd1d
where we created a callback function by concatenating strings. It's
unnecessary since d638cdc42a.
This commit is contained in:
Ankur 2022-06-03 18:06:28 +05:45 committed by Mariusz Felisiak
parent 8d160f154f
commit d19a53d8e3

View File

@ -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();