summaryrefslogtreecommitdiff
path: root/js_tests
diff options
context:
space:
mode:
authorsarahboyce <sarahvboyce95@gmail.com>2023-06-08 09:51:12 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-06-09 12:18:17 +0200
commit531f557f9238b8f2e5032e569cf36f0c05bb4043 (patch)
tree5231aa8d4525c05b51a8b87808c6f114980bd08b /js_tests
parentb81e974e9ea16bd693b194a728f77fb825ec8e54 (diff)
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.
Diffstat (limited to 'js_tests')
-rw-r--r--js_tests/admin/core.test.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/js_tests/admin/core.test.js b/js_tests/admin/core.test.js
index ea780d01d0..c549ad99c9 100644
--- a/js_tests/admin/core.test.js
+++ b/js_tests/admin/core.test.js
@@ -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) {