Datetimepicker custom date range

Get help from other users here.

Moderators: Contributor, Developer

Datetimepicker custom date range

Postby jdp » Oct 31, 2017 3:00 am

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: Oct 30, 2017 11:19 am

Re: Datetimepicker custom date range

Postby jdp » Nov 05, 2017 3:14 am

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/
jdp
 
Posts: 2
Joined: Oct 30, 2017 11:19 am


Return to Help

Who is online

Users browsing this forum: No registered users and 9 guests