diff options
| author | Farhaan Bukhsh <farhaan.bukhsh@gmail.com> | 2019-10-11 23:33:29 +0700 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-12-30 13:06:29 +0100 |
| commit | cf5d4701dc12ad69d51042b0d7e81e4a54de4bd7 (patch) | |
| tree | 3478806702ca23e43da4ab85db2b924543af8710 /js_tests | |
| parent | 550357771b592568399eda08556bb2a749da69fe (diff) | |
Fixed #30819 -- Fixed year determination in admin calendar widget for two-digit years.
Two-digit years in the range of [00, 68] are in the current century,
while [69,99] are in the previous century, according to the Open Group
Specification.
Diffstat (limited to 'js_tests')
| -rw-r--r-- | js_tests/admin/core.test.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/js_tests/admin/core.test.js b/js_tests/admin/core.test.js index 8904e5ad9f..9e1f3fa9b6 100644 --- a/js_tests/admin/core.test.js +++ b/js_tests/admin/core.test.js @@ -55,6 +55,7 @@ QUnit.test('String.strptime', function(assert) { assert.equal(firstParsedDate.getUTCMonth(), 1); assert.equal(firstParsedDate.getUTCFullYear(), 1988); + // A %y value in the range of [69, 99] is in the previous century. var secondParsedDate = '26/02/88'.strptime('%d/%m/%y'); assert.equal(secondParsedDate.getUTCDate(), 26); assert.equal(secondParsedDate.getUTCMonth(), 1); @@ -67,6 +68,12 @@ QUnit.test('String.strptime', function(assert) { assert.equal(thirdParsedDate.getUTCMonth(), 10); assert.equal(thirdParsedDate.getUTCFullYear(), 1983); + // A %y value in the range of [00, 68] is in the current century. + var fourthParsedDate = '27/09/68'.strptime('%d/%m/%y'); + assert.equal(fourthParsedDate.getUTCDate(), 27); + assert.equal(fourthParsedDate.getUTCMonth(), 8); + assert.equal(fourthParsedDate.getUTCFullYear(), 2068); + // Extracting from a Date object with local time must give the correct // result. Without proper conversion, timezones from GMT+0100 to GMT+1200 // gives a date one day earlier than necessary, e.g. converting local time |
