trentrichardson / jQuery-Timepicker-Addon

Adds a timepicker to jQueryUI Datepicker
http://trentrichardson.com/examples/timepicker/
MIT License
2.66k stars 1.05k forks source link

Time format is invalid #902

Open poliaca opened 7 years ago

poliaca commented 7 years ago

"Hours" which is specified in property of defaultValue is ignored and returns "0" when he clicks a component and a calendar is displayed, on condition that timeFormat property is only "Hours". (These errors are described with sample codes : "6 o'clock" can be displayed on calendar, but "0 o'clock" is on the screen. )

If these symptoms are bugs, would you correct them? If not, please show me a solution.

The following is the sample code : $('#xxx').datetimepicker({ dateFormat: 'y/mm', timeFormat: 'HH', defaultValue: '2016/11/08 06:07:08', controlType: 'select' });

ChristophKnopf commented 7 years ago

This is maybe too late but I did the same mistake. To get it work don't use the dateFormat AND timeFormat properties at the same time, choose one of them.

poliaca commented 7 years ago

It is meaningless if only one of them can be set. Is this a bug?

ChristophKnopf commented 7 years ago

I was wrong, you can configure dateFormat and timeFormat properties the same time. Sorry for that. I tested you example and it works fine for me, I can choose every hour and it is correctly displayed on the screen. Do you have another example for me to help you?

Edit: I think I understand your problem now. You are expecting the hours to be 6 already when the datimepicker opens, right? But it is '00' ( I am using local and 24 time format, so for me its 00).