Page 1 of 1

Datetimepicker custom date range

Posted: 31 Oct 2017, 08:00
by jdp
Hello everyone,

I've been asked in my company to do some customizations into Mantis 2.3.0, and one of it is about preventing the user to select a date after the today date.
Unfortunately so far I've not been able to do so with the following suggestions found into the net:
## Using the maxDate attribute through Javascript ##
$(function() {
$( "#datepicker" ).datepicker({ maxDate: new Date });
});

##Using the data-date-start-date and data-date-end-date attributes directly into my inputs##
data-date-start-date="0d"
data-date-end-date="0d"

##Using the endDate attribute through Javascript ##
$(function() {
$( "#datepicker" ).datepicker({
endDate: +0d });
});

Is there anyone who has found a solution please ?

Thanks in advance for your help,

Re: Datetimepicker custom date range

Posted: 05 Nov 2017, 08:14
by jdp
Finally one of my colleague has found the solution, so I share it with you here:

Code: Select all

    var today= new Date(); 
    $('#myDateTime').data("DateTimePicker").maxDate(today);
Here's the site where we found the solution:
https://eonasdan.github.io/bootstrap-datetimepicker/