set hour in DateTimePicker more than 23

雨燕双飞 提交于 2020-01-04 04:03:08

问题


In my project , I need using Timepicker with format HH:MM , but I use it like duration , not a time , so is it possible to increase HH upto 99 , not stop in 23 !

I using datetime picker from this page : http://tarruda.github.io/bootstrap-datetimepicker/

After several time to edit js file , I found that I must change js code in "getUTCHours()" method from http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js file to get my goal !

But I cannot find the define of this method :(

Can anyone help me ? Thanks all in advances !

Valentino !


回答1:


Yes it is possible, the code has a condition that whenever it detects the hour is equal or greater than 23 it will reset to 23.

In this code there is no limit.

In Bootstrap.timepicker.js

Search for "23" or "24" in the code

You will find the following

`this.hour>=24?this.hour = 23`

I changed to

this.hour>=24?this.hour = this.hour without Limit.

To make it Up to 99 changue it to.

`this.hour>99?this.hour = 99`     **UP to 99**

Be sure to use

`showMeridian = false`, 

to make this work.

Im using "time" variable type in MYSQL and is working just fine.

Now it Works.



来源:https://stackoverflow.com/questions/19210054/set-hour-in-datetimepicker-more-than-23

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!