[QSO entry] Custom date format

This commit is contained in:
Andreas Kristiansen
2025-07-14 14:02:20 +02:00
parent 76779b95b6
commit 1e863ade5d
4 changed files with 136 additions and 24 deletions

View File

@@ -76,8 +76,23 @@ class Logbook extends CI_Controller {
function json($tempcallsign, $tempband, $tempmode, $tempstation_id = null, $date = "", $count = 5) {
session_write_close();
if (($date ?? '') != '') {
$date=date("Y-m-d",strtotime($date));
// Normalize the date only if it's not empty
if (!empty($date)) {
// Get user-preferred date format
if ($this->session->userdata('user_date_format')) {
$date_format = $this->session->userdata('user_date_format');
} else {
$date_format = $this->config->item('qso_date_format');
}
$date = urldecode($date);
$dt = DateTime::createFromFormat($date_format, $date);
if ($dt !== false) {
$date = $dt->format('Y-m-d'); // or any normalized format
} else {
// Invalid date for the expected format, handle gracefully
$date = null;
}
}
// Cleaning for security purposes
$callsign = $this->security->xss_clean($tempcallsign);