Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions mailscanner/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -978,26 +978,31 @@ function updateClock() {
var currentHours = currentTime.getHours();
var currentMinutes = currentTime.getMinutes();
var currentSeconds = currentTime.getSeconds();
var timeOfDay = "";

// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
';

if (TIME_FORMAT === '%h:%i:%s') {
echo '
// Choose either "AM" or "PM" as appropriate
timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

// Convert an hours component of "0" to "12"
currentHours = ( currentHours === 0 ) ? 12 : currentHours;';
currentHours = ( currentHours === 0 ) ? 12 : currentHours;
';
}
else {
echo '
// also pad the hours with leading zeros, if required (24h time format)
currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;
';
}

echo '

// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

Expand Down
Loading