From 3258f4fb79fc19e99aef048e0006a8f569020e06 Mon Sep 17 00:00:00 2001 From: Jonathan Rehm Date: Tue, 18 Jul 2017 14:20:32 -0700 Subject: [PATCH] Make changes requested by Codacy --- cps/static/js/edit_books.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cps/static/js/edit_books.js b/cps/static/js/edit_books.js index 419d8031..3aeba542 100644 --- a/cps/static/js/edit_books.js +++ b/cps/static/js/edit_books.js @@ -1,7 +1,7 @@ /** * Created by SpeedProg on 05.04.2015. */ -/* global Bloodhound, language */ +/* global Bloodhound, language, Modernizr, tinymce */ tinymce.init({ selector: '#description', @@ -11,19 +11,20 @@ tinymce.init({ }); if (!Modernizr.inputtypes.date) { - $('#pubdate').datepicker({ - format: 'yyyy-mm-dd', + $("#pubdate").datepicker({ + format: "yyyy-mm-dd", language: language - }).on('change', function () { + }).on("change", function () { // Show localized date over top of the standard YYYY-MM-DD date - let pubDate, results; - if ((results = /(\d{4})[-\/\\](\d{1,2})[-\/\\](\d{1,2})/.exec(this.value))) { // YYYY-MM-DD + let pubDate; + const results = /(\d{4})[-\/\\](\d{1,2})[-\/\\](\d{1,2})/.exec(this.value); // YYYY-MM-DD + if (results) { pubDate = new Date(results[1], parseInt(results[2], 10)-1, results[3]) || new Date(this.value); } - $('#fake_pubdate') + $("#fake_pubdate") .val(pubDate.toLocaleDateString(language)) - .removeClass('hidden'); - }).trigger('change'); + .removeClass("hidden"); + }).trigger("change"); } /*