Datetimepicker custom date range

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
jdp
Posts: 2
Joined: 30 Oct 2017, 16:19

Datetimepicker custom date range

Post 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,
jdp
Posts: 2
Joined: 30 Oct 2017, 16:19

Re: Datetimepicker custom date range

Post 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/
Post Reply