From 1b03da8b9b2d614edc0595d394fc582203c4f702 Mon Sep 17 00:00:00 2001 From: phl0 Date: Sun, 25 Sep 2022 12:32:39 +0200 Subject: [PATCH] Time and Date shortcuts also for contesting page --- assets/js/sections/contesting.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/assets/js/sections/contesting.js b/assets/js/sections/contesting.js index 4740b50c..2b246e4d 100644 --- a/assets/js/sections/contesting.js +++ b/assets/js/sections/contesting.js @@ -159,6 +159,27 @@ document.onkeyup = function (e) { }; +/* time input shortcut */ +$('#start_time').change(function() { + var raw_time = $(this).val(); + if(raw_time.match(/^\d\[0-6]d$/)) { + raw_time = "0"+raw_time; + } + if(raw_time.match(/^[012]\d[0-5]\d$/)) { + raw_time = raw_time.substring(0,2)+":"+raw_time.substring(2,4); + $('#start_time').val(raw_time); + } +}); + +/* date input shortcut */ +$('#start_date').change(function() { + raw_date = $(this).val(); + if(raw_date.match(/^[12]\d{3}[01]\d[0123]\d$/)) { + raw_date = raw_date.substring(0,4)+"-"+raw_date.substring(4,6)+"-"+raw_date.substring(6,8); + $('#start_date').val(raw_date); + } +}); + // On Key up check and suggest callsigns $("#callsign").keyup(function () { var call = $(this).val();