mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 02:14:13 +00:00
add 'd M y' date format
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -210,6 +210,7 @@
|
||||
<option value="Y-m-d" <?php if($user_date_format == "Y-m-d") { echo "selected=\"selected\""; } ?>><?php echo date('Y-m-d'); ?> - ( YYYY-MM-DD )</option>
|
||||
<option value="M d, Y" <?php if($user_date_format == "M d, Y") { echo "selected=\"selected\""; } ?>><?php echo date('M d, Y'); ?> - ( MMM DD, YYYY )</option>
|
||||
<option value="M d, y" <?php if($user_date_format == "M d, y") { echo "selected=\"selected\""; } ?>><?php echo date('M d, y'); ?> - ( MMM DD, YY )</option>
|
||||
<option value="d M y" <?php if($user_date_format == "d M y") { echo "selected=\"selected\""; } ?>><?php echo date('d M y'); ?> - ( DD MMM YY )</option>
|
||||
</select>
|
||||
<small id="SelectDateFormatHelp" class="form-text text-muted"><?= __("Select how you would like dates shown when logged into your account."); ?></small>
|
||||
</div>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user