set hour in DateTimePicker more than 23

2019-07-12 23:12发布

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条回答
女痞
2楼-- · 2019-07-12 23:33

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.

查看更多
登录 后发表回答