From 1f677bbe6d17e9488110598cd3821481cf660ab9 Mon Sep 17 00:00:00 2001 From: kc9uhi Date: Sun, 18 Jan 2026 11:34:46 -0700 Subject: [PATCH] add 'd M y' date format --- application/controllers/Distancerecords.php | 1 + application/views/qso/index.php | 1 + application/views/user/edit.php | 1 + assets/js/sections/contesting.js | 4 ++++ assets/js/sections/qso.js | 16 ++++++++++++++++ 5 files changed, 23 insertions(+) diff --git a/application/controllers/Distancerecords.php b/application/controllers/Distancerecords.php index fec4a228b..53f906987 100644 --- a/application/controllers/Distancerecords.php +++ b/application/controllers/Distancerecords.php @@ -31,6 +31,7 @@ class Distancerecords extends CI_Controller { case 'Y-m-d': $usethisformat = 'YYYY-MM-D';break; case 'M d, Y': $usethisformat = 'MMM D, YYYY';break; case 'M d, y': $usethisformat = 'MMM D, YY';break; + case 'd M y': $usethisformat = 'D MMM YY';break; } if ($this->session->userdata('user_measurement_base') == NULL) { diff --git a/application/views/qso/index.php b/application/views/qso/index.php index bd657926b..6dbd4e8d9 100644 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -20,6 +20,7 @@ switch ($date_format) { case "Y-m-d": $current_pattern = '[0-9]{4}-[0-1][0-9]-[0-3][0-9]'; break; case "M d, Y": $current_pattern = '[A-Za-z]{3}\s[0-3][0-9],\s[0-9]{4}'; break; case "M d, y": $current_pattern = '[A-Za-z]{3}\s[0-3][0-9],\s[0-9]{2}'; break; + case "d M y": $current_pattern = '[0-3][0-9]\s[A-Za-z]{3}\s[0-9]{2}'; break; default: $current_pattern = '[0-3][0-9]-[0-1][0-9]-[0-9]{4}'; $date_format = 'd-m-Y'; } ?> diff --git a/application/views/user/edit.php b/application/views/user/edit.php index 9baa9a766..311824e3b 100644 --- a/application/views/user/edit.php +++ b/application/views/user/edit.php @@ -210,6 +210,7 @@ + diff --git a/assets/js/sections/contesting.js b/assets/js/sections/contesting.js index f4902672d..aeae337ee 100644 --- a/assets/js/sections/contesting.js +++ b/assets/js/sections/contesting.js @@ -969,6 +969,10 @@ function getUTCDateStamp(el) { var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; formatted_date = monthNames[now.getUTCMonth()] + " " + parseInt(day) + ", " + short_year; break; + case "d M y": + var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + formatted_date = parseInt(day) + " " + monthNames[now.getUTCMonth()] + " " + short_year; + break; default: // Default to d-m-Y format as shown in the PHP code formatted_date = day + "-" + month + "-" + year; diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 8b8e61e86..8ee78dac2 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -126,6 +126,10 @@ function getUTCDateStamp(el) { var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; formatted_date = monthNames[now.getUTCMonth()] + " " + parseInt(day) + ", " + short_year; break; + case "d M y": + var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + formatted_date = parseInt(day) + " " + monthNames[now.getUTCMonth()] + " " + short_year; + break; default: // Default to d-m-Y format as shown in the PHP code formatted_date = day + "-" + month + "-" + year; @@ -552,6 +556,10 @@ $("#reset_start_time").on("click", function () { var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; formatted_date = monthNames[now.getUTCMonth()] + " " + parseInt(day) + ", " + short_year; break; + case "d M y": + var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + formatted_date = parseInt(day) + " " + monthNames[now.getUTCMonth()] + " " + short_year; + break; default: // Default to d-m-Y format as shown in the PHP code formatted_date = day + "-" + month + "-" + year; @@ -621,6 +629,14 @@ function parseUserDate(user_provided_date) { // creates JS-Date out of user-prov day = parseInt(parts[1], 10); year = 2000 + parseInt(parts[2], 10); break; + case "d M y": + // Example: 28 Jul 25 + parts = user_provided_date.split(' '); + day = parseInt(parts[0], 10); + month = monthNames.indexOf(parts[1]); + if (month === -1) return null; + year = 2000 + parseInt(parts[2], 10); + break; default: // fallback "d-m-Y" parts = user_provided_date.split("-"); day = parseInt(parts[0], 10);