From 60d85d7b542fcf0f52e01d93d2103f14d4b7c408 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Sat, 8 Jun 2024 21:25:52 +0200 Subject: [PATCH] chore: migrate JS to ES2015 Use let/const instead of var. --- constance/static/admin/js/constance.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/constance/static/admin/js/constance.js b/constance/static/admin/js/constance.js index bea4ba68..d828592b 100644 --- a/constance/static/admin/js/constance.js +++ b/constance/static/admin/js/constance.js @@ -6,17 +6,17 @@ $('#content-main').on('click', '.reset-link', function(e) { e.preventDefault(); - var field_selector = this.dataset.fieldId.replace(/ /g, "\\ ") - var field = $('#' + field_selector); - var fieldType = this.dataset.fieldType; + const field_selector = this.dataset.fieldId.replace(/ /g, "\\ ") + const field = $('#' + field_selector); + const fieldType = this.dataset.fieldType; if (fieldType === 'checkbox') { field.prop('checked', this.dataset.default === 'true'); } else if (fieldType === 'date') { - var defaultDate = new Date(this.dataset.default * 1000); + const defaultDate = new Date(this.dataset.default * 1000); $('#' + this.dataset.fieldId).val(defaultDate.strftime(get_format('DATE_INPUT_FORMATS')[0])); } else if (fieldType === 'datetime') { - var defaultDate = new Date(this.dataset.default * 1000); + const defaultDate = new Date(this.dataset.default * 1000); $('#' + this.dataset.fieldId + '_0').val(defaultDate.strftime(get_format('DATE_INPUT_FORMATS')[0])); $('#' + this.dataset.fieldId + '_1').val(defaultDate.strftime(get_format('TIME_INPUT_FORMATS')[0])); } else {