gijgo
gijgo copied to clipboard
Fix 12 hour format for 12:00am
Can someone edit this file: https://github.com/atatanasov/gijgo/blob/master/src/timepicker/js/timepicker.base.js
and add in a clause that is the hour is 0, change it 12 in an "ampm" format?
I would do that myself, but I am away with only an iPad right now lol
Same issue for me.
This problem still exists
Do you have this issue when you set the time through the code with value method or you get the value from the control. Could you provide replication steps.
it's very simple to replicate
If I choose this time:
I get this:

Another issue is that if I choose a PM time
And I want to edit such time again, the time is set to AM instead of PM as it should be

Last issue, if I have 12PM
And I open the modal It looks like this:
if I press ok, it will interpret it like it was 12AM and then changes the time to 00:00:00AM again
Same problem here. Displays correctly if value is set in the method.
Hi! I had a similar issue.
When I was picking a time for the first time and my local time was between 12PM and 13PM, the selected time on the picker was correctly displayed as 12:XX PM, but the saved time on the input was 00:XX.
This happens only on the first time, if I open the picker again, now the displayed time is 00:XX AM.
I made a modification on the following line of the source code: https://github.com/atatanasov/gijgo/blob/1968d51097a82b44e78dfd70d03b9eb0bdb2e312/src/timepicker/js/timepicker.base.js#L607
Basically, the original code was:
$clock.attr('mode', hour > 12 ? 'pm' : 'am');
and the modified code is:
$clock.attr('mode', hour >= 12 ? 'pm' : 'am');
Problem solved.
I'll try to do a PR, I've never do it before, but I can learn.
I am having the same issue as @cuartas15. If the time in the field is 3:45 PM and you open the picker it shows 3:45 AM. @fernandogutierrez27 fix won't work because the hour is always going to be less than 12 when set to 12 hour time.
These are the settings I have to initialize the picker.
var timepicker = $('#timepicker').timepicker({
mode: 'ampm',
format: 'h:MM TT'
});
Is there a fix for this?
I managed to fix most of the problems long time ago editing the source file but those fixes are too specific for my application
Thanks for the quick response @cuartas15. Our client was saying times were being set to AM whenever they edited the time. We hunted our code but couldn't see any reason why it may be happening until I noticed this issue yesterday. I was hoping we wouldn't have to try and debug it ourselves. Sigh...
Yeah, this library doesn't have an active support, I really like it but the cold reality is that there may be better options out there. Like I said, I had to go and learn the source code in order to fix the multiple issues (like the datetimepicker not having a 12h format time picker, etc)