#33784: Formats should not be escaped in admin calendar widget. ----------------------------------+-------------------------------------- Reporter: Mariusz Felisiak | Owner: Ankur Roy Type: Bug | Status: assigned Component: contrib.admin | Version: 4.0 Severity: Normal | Resolution: Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------------+--------------------------------------
Comment (by Mariusz Felisiak): Ankur, would you like to prepare a patch? and drop these replacements, e.g. {{{#!diff diff --git a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js index ea8c155d74..aa1cae9eeb 100644 --- a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js +++ b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js @@ -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() }}} -- Ticket URL: <https://code.djangoproject.com/ticket/33784#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/01070181608f62a7-c43ab07f-b983-4b9e-aea9-b30bb7e13e3d-000000%40eu-central-1.amazonses.com.