diff options
| author | Vedran Karacic <karacicvedran@gmail.com> | 2025-12-12 10:04:19 +0100 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-04-29 11:28:13 -0400 |
| commit | 61941b6fc172933f425e8ba76bab444ab9b313e4 (patch) | |
| tree | a59cfb9faa571f6cc329ee8d0868578646169a2b /js_tests | |
| parent | 604695cddb41981b84a8d976d1f4c74c39e112b0 (diff) | |
Fixed #35951 -- Mentioned server timezone in admin DateTime widgets.
The existing note that is shown to the users when entering a time value
from a different timezone than the server's timezone was not descriptive
enough and led to confusion. This commit updates the note to explicitly
state that the user should enter times in the server's timezone.
Diffstat (limited to 'js_tests')
| -rw-r--r-- | js_tests/admin/DateTimeShortcuts.test.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/js_tests/admin/DateTimeShortcuts.test.js b/js_tests/admin/DateTimeShortcuts.test.js index 5c850ce7d2..28d07fb918 100644 --- a/js_tests/admin/DateTimeShortcuts.test.js +++ b/js_tests/admin/DateTimeShortcuts.test.js @@ -1,7 +1,15 @@ /* global QUnit, DateTimeShortcuts */ "use strict"; -QUnit.module("admin.DateTimeShortcuts"); +QUnit.module("admin.DateTimeShortcuts", { + afterEach: function () { + const $ = django.jQuery; + $("body") + .removeAttr("data-admin-server-timezone") + .removeAttr("data-admin-utc-offset"); + $(".timezonewarning").remove(); + }, +}); QUnit.test("init", function (assert) { const $ = django.jQuery; @@ -46,11 +54,13 @@ QUnit.test("time zone offset warning - single field", function (assert) { "data-admin-utc-offset", new Date().getTimezoneOffset() * -60 + 3600, ); + $("body").attr("data-admin-server-timezone", "America/Chicago"); DateTimeShortcuts.init(); $("body").attr("data-admin-utc-offset", savedOffset); assert.equal( $(".timezonewarning").text(), - "Note: You are 1 hour behind server time.", + "Note: Enter times in the America/Chicago timezone. " + + "(You are 1 hour behind.)", ); assert.equal( $(".timezonewarning").attr("id"), @@ -75,6 +85,10 @@ QUnit.test("time zone offset warning - date and time field", function (assert) { DateTimeShortcuts.init(); $("body").attr("data-admin-utc-offset", savedOffset); assert.equal( + $(".timezonewarning").text(), + "Note: Enter times in the server timezone. (You are 1 hour behind.)", + ); + assert.equal( $(".timezonewarning").attr("id"), "id_updated_at_timezone_warning_helptext", ); |
