Bootstrap 3 datetimepicker jquery

I am using Datetimepicker from https://eonasdan.imtqy.com/bootstrap-datetimepicker/ for my project.

enter image description here

what I want to achieve is that the end should not be able to choose a time earlier than the beginning.

$('#timePickerStart').datetimepicker({ format : 'LT' }); $('#timePickerEnd').datetimepicker({ format : 'LT' }); 

datetimepicker has a function similar to this date, but I don't know how to implement it on time.

thanks.

+5
source share
1 answer

You can disable certain time intervals using the disabledTimeIntervals property and function. An array requires two moment objects. Another way to disable certain hours is with the disabledHours and disabledHours() properties.

What you can do is: when the user changes one of the collectors, start the callback. In this callback, you can use the date() function to get the current moment, and then set the other collector as the upper / lower bound using disabledTimeIntervals .

+2
source

Source: https://habr.com/ru/post/1233849/


All Articles