Calendar field with time timeformat="12" format="%Y-%m-%d %H:%M:%S"
While the datepicker pop up is displayed having the hour set to 12 and AM the input field's hour portion should update to a "00" like the 1-11 hours have +12 added onto them when PM is selected.
The hour portion of the input field remains a 12 even if you select AM.
Joomla 3.7.5
PHP Version 7.0.22-0ubuntu0.16.04.1
Apache Version Apache/2.4.18 (Ubuntu)
I have tested this on a 3.8.0 build, and the error persists.
Status | New | ⇒ | Information Required |
Correct there is no such thing, but I never stated that either.
Brian please look at my screen shot.
When you select 3 PM, the input field above shows the (24 hour time) 15:00:00
When you select 12 AM the input field above should show the (24 hour time) as 00:00:00
It is done by the Java Script. When you have either [1-11] selected as the hour in the time picker, and if you flip back and forth AM or PM, in the date/time field above the hour has +12 added to it when PM is selected.
Look at the screen shot.
%H - Hour of the day, 24-hour clock, zero-padded (00..23)
%I - Hour of the day, 12-hour clock, zero-padded (01..12)
Again your format is wrong
The "timeformat" attribute dictates how the drop-down menus will be in the Calendar itself.
The "format" attribute dictates what the formatting will look like in the input field itself. I am using %H already that is why when 3 PM is selected 15:00:00 is displayed in the input field.
If I am wrong why is 3 PM correctly being converted into 15:00:00 ?
Working with the uncompressed javascript file
media/system/js/fields/calendar.js
Line 181
} else if (/am/i.test(ampm.value) && hours === 12) {
Needs to be == 12 when doing the comparision
Line 751
pm = (altDate.getHours() > 12);
Needs to be >= 12 due to altDate.getHours() returning [0-23] which makes 12 a pm hour
Line 969
hoursEl.value = hrs;
Do a condition chech of !this.params.time24 and if hrs == 00 hoursEl.value = 12 else hoursEl.value = hrs
if (!this.params.time24) { hoursEl.value = (hrs == "00") ? "12" : hrs; } else { hoursEl.value = hrs; }
Those are the changes I made.
This is my final comment on the issue.
ah i understand you now - sorry for being thick
I will look at making a PR to fix this
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-10-04 23:38:55 |
Closed_By | ⇒ | brianteeman |
Sorry but you are not correct. There is no such thing as 00:00 am
https://en.wikipedia.org/wiki/12-hour_clock