mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #31493 -- Replaced var with const and let keywords in JavaScript.
The eslint configuration and the admin script compress.py have been updated for ES6. The unused fallback of globals.django in jquery.init.js was removed. It is always included before jsi18n-mocks.test.js and it always sets the global value.
This commit is contained in:
parent
0dafadadb9
commit
5d37cc703b
30 changed files with 401 additions and 406 deletions
|
@ -42,7 +42,7 @@ QUnit.test('Date.getTwoDigitSecond', function(assert) {
|
|||
});
|
||||
|
||||
QUnit.test('Date.strftime', function(assert) {
|
||||
var date = new Date(2014, 6, 1, 11, 0, 5);
|
||||
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');
|
||||
});
|
||||
|
@ -50,26 +50,26 @@ QUnit.test('Date.strftime', function(assert) {
|
|||
QUnit.test('String.strptime', function(assert) {
|
||||
// Use UTC functions for extracting dates since the calendar uses them as
|
||||
// well. Month numbering starts with 0 (January).
|
||||
var firstParsedDate = '1988-02-26'.strptime('%Y-%m-%d');
|
||||
const firstParsedDate = '1988-02-26'.strptime('%Y-%m-%d');
|
||||
assert.equal(firstParsedDate.getUTCDate(), 26);
|
||||
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');
|
||||
const secondParsedDate = '26/02/88'.strptime('%d/%m/%y');
|
||||
assert.equal(secondParsedDate.getUTCDate(), 26);
|
||||
assert.equal(secondParsedDate.getUTCMonth(), 1);
|
||||
assert.equal(secondParsedDate.getUTCFullYear(), 1988);
|
||||
|
||||
var format = django.get_format('DATE_INPUT_FORMATS')[0];
|
||||
var thirdParsedDate = '1983-11-20'.strptime(format);
|
||||
const format = django.get_format('DATE_INPUT_FORMATS')[0];
|
||||
const thirdParsedDate = '1983-11-20'.strptime(format);
|
||||
|
||||
assert.equal(thirdParsedDate.getUTCDate(), 20);
|
||||
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');
|
||||
const fourthParsedDate = '27/09/68'.strptime('%d/%m/%y');
|
||||
assert.equal(fourthParsedDate.getUTCDate(), 27);
|
||||
assert.equal(fourthParsedDate.getUTCMonth(), 8);
|
||||
assert.equal(fourthParsedDate.getUTCFullYear(), 2068);
|
||||
|
@ -80,10 +80,9 @@ QUnit.test('String.strptime', function(assert) {
|
|||
// Feb 26, 1988 00:00:00 EEST is Feb 25, 21:00:00 UTC.
|
||||
|
||||
// Checking timezones from GMT+0100 to GMT+1200
|
||||
var i, tz, date;
|
||||
for (i = 1; i <= 12; i++) {
|
||||
tz = i > 9 ? '' + i : '0' + i;
|
||||
date = new Date(Date.parse('Feb 26, 1988 00:00:00 GMT+' + tz + '00'));
|
||||
for (let i = 1; i <= 12; i++) {
|
||||
const tz = i > 9 ? '' + i : '0' + i;
|
||||
const date = new Date(Date.parse('Feb 26, 1988 00:00:00 GMT+' + tz + '00'));
|
||||
assert.notEqual(date.getUTCDate(), 26);
|
||||
assert.equal(date.getUTCDate(), 25);
|
||||
assert.equal(date.getUTCMonth(), 1);
|
||||
|
@ -91,9 +90,9 @@ QUnit.test('String.strptime', function(assert) {
|
|||
}
|
||||
|
||||
// Checking timezones from GMT+0000 to GMT-1100
|
||||
for (i = 0; i <= 11; i++) {
|
||||
tz = i > 9 ? '' + i : '0' + i;
|
||||
date = new Date(Date.parse('Feb 26, 1988 00:00:00 GMT-' + tz + '00'));
|
||||
for (let i = 0; i <= 11; i++) {
|
||||
const tz = i > 9 ? '' + i : '0' + i;
|
||||
const date = new Date(Date.parse('Feb 26, 1988 00:00:00 GMT-' + tz + '00'));
|
||||
assert.equal(date.getUTCDate(), 26);
|
||||
assert.equal(date.getUTCMonth(), 1);
|
||||
assert.equal(date.getUTCFullYear(), 1988);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue