1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #23049 -- Added %a and %A support to Date.strftime.

This enables the admin to display the day as locale's abbreviated/full
name if %a/%A is used in the date format.
This commit is contained in:
sarahboyce
2023-06-08 09:51:12 +02:00
committed by Mariusz Felisiak
parent b81e974e9e
commit 531f557f92
4 changed files with 49 additions and 3 deletions

View File

@@ -50,11 +50,23 @@ QUnit.test('Date.getFullMonthName', function(assert) {
assert.equal(new Date(2020, 9, 26).getFullMonthName(), 'October', 'oct 26');
});
QUnit.test('Date.getAbbrevDayName', function(assert) {
assert.equal(new Date(2020, 0, 26).getAbbrevDayName(), 'Sun', 'jan 26 2020 is a Sunday');
assert.equal(new Date(2020, 9, 26).getAbbrevDayName(), 'Mon', 'oct 26 2020 is a Monday');
});
QUnit.test('Date.getFullDayName', function(assert) {
assert.equal(new Date(2020, 0, 26).getFullDayName(), 'Sunday', 'jan 26 2020 is a Sunday');
assert.equal(new Date(2020, 9, 26).getFullDayName(), 'Monday', 'oct 26 2020 is a Monday');
});
QUnit.test('Date.strftime', function(assert) {
const date = new Date(2014, 6, 1, 11, 0, 5);
assert.equal(date.strftime('%Y-%m-%d %H:%M:%S'), '2014-07-01 11:00:05');
assert.equal(date.strftime('%B %d, %Y'), 'July 01, 2014');
assert.equal(date.strftime('%b %d, %Y'), 'Jul 01, 2014');
assert.equal(date.strftime('%a %d %m %y'), 'Tue 01 07 14');
assert.equal(date.strftime('%A (day %w of week) %I %p'), 'Tuesday (day 02 of week) 11 AM');
});
QUnit.test('String.strptime', function(assert) {