fix the rest of local-time.js somehow

This commit is contained in:
Lorenzo Yario 2024-06-20 20:38:35 -07:00 committed by GitHub
parent 5b0a7fb975
commit b21865853b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,15 +21,20 @@ $(document).ready(function(){
if (parts.length === 2) { if (parts.length === 2) {
var timeParts = parts[1].split(':'); var timeParts = parts[1].split(':');
if (timeParts.length === 3) { if (timeParts.length === 3) {
var secondsParts = timeParts[2].split('.'); var seconds = timeParts[2];
if (secondsParts[0] > 59) { if (seconds.length > 2) {
secondsParts[0] = '59'; seconds = seconds.substr(0, 2) + '.' + seconds.substr(2);
} }
timeParts[2] = secondsParts.join('.'); // Ensure seconds part is valid
if (parseFloat(seconds) > 59) {
seconds = '59';
}
timeParts[2] = seconds;
} }
parts[1] = timeParts.join(':'); parts[1] = timeParts.join(':');
} }
s = parts.join('T'); s = parts.join('T');
if (!s.endsWith('Z')) { if (!s.endsWith('Z')) {
s += 'Z'; s += 'Z';
} }
@ -123,3 +128,4 @@ $(document).ready(function(){
do_localtime(document); do_localtime(document);
}); });