Click here to Skip to main content
15,885,182 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am setting min and max value of datepicker in if & else condtion. It's working fine in drop down 1st indexed change event and when again I changed the dropdownlist value the min and max value of datepicker is not set again. It was same as 1st indexed event changed value.
How to refresh the min and max value of datepicker ? 


What I have tried:

I wrote following code in if and else condition.
$expiryDate.datetimepicker({
           minDate: moment({ h: Hours, m: Minutes }),
           maxDate: maxCalculatedDate,
           format: 'DD-MM-YYYY'
       });
Posted
Updated 26-Dec-19 19:30pm
v3
Comments
DerekT-P 28-Dec-19 11:47am    
Can you include more of your code, please. We need to see the context of what you've done, your if..else etc.
SanketLodha 2-Jan-20 2:54am    
I am getting txtExpiryDate through some logic in my code.

var maxtxtExpiryDate = moment(txtExpiryDate, 'DD-MM-YYYY');
$txtExpiryDate.datetimepicker({
minDate: moment({ h: Hours, m: Minutes }),
maxDate: maxtxtExpiryDate ,
format: 'DD-MM-YYYY'
});
DerekT-P 2-Jan-20 4:50am    
SanketLodha - this isn't valid code. As per earlier comment, we need to see your CODE - not what you THINK you've written. All the code relating to the input box, the dropdown.. ALL the related javascript and HTML.
I use exactly similar logic in several of my sites - a datepicker whose range is determined by the selection from a dropdown box - so it most certainly can be done but we can't find the problem in your code if we can't see your code! :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900