From 5197014eff14c5744e56138e8d22cd571676f838 Mon Sep 17 00:00:00 2001 From: Ankur Date: Fri, 3 Jun 2022 18:06:28 +0545 Subject: [PATCH] [4.1.x] Fixed #33784 -- Removed unnecessary format escaping in admin calendar widget. Replacements were added in fa0653cd1d791a8bce835e8992cbeab6fd70d0e7 where we created a callback function by concatenating strings. It's unnecessary since d638cdc42acec608c1967f44af6be32a477c239f. Backport of d19a53d8e3640e8f937048bf7826c7e2229a9665 from main --- .../admin/static/admin/js/admin/DateTimeShortcuts.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js index 9bad0f54cb..176b0e3edc 100644 --- a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js +++ b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js @@ -388,13 +388,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();