3
Answers

Date Range for start and end dates

Sai

Sai

7y
164
1
Hi friends,
 
can you please solve my issue.
 
Requriement:
==========
 
i have 2 jquery datepicker.
 
$("#startdate").datepicker({
format: 'dd/mm/yyyy',
autoclose: true,
todayHighlight: true
});
$("#enddate").datepicker({
format: 'dd/mm/yyyy',
autoclose: true,
todayHighlight: true,
});
 
Now the thing is if i choose startdate 12/Dec/2017 and enddate should be 13/dec/2017 or increase date .
 
but when i select enddate lessthan start date it should not allow.
 
Main thing is when i choose startdate 12/dec/2017 and enddate contains only 12 to end of that particular month days should be visible..before days should be disable..it doesn't allow to select the enddate like 11/dec/2017.
 
If i select any year,month and day for startend then immediately enddate should be greater only
 
it doesn't allow to select less date.
 
i.e 12/jan/2000 startdate
11/feb/2013 enddate }=>correct input
12/jan/2000 startdate
11/jan/2000 enddate }=>incorrectinput
 
i hope you understand my problem.
 
Please help me..
Regards
Answers (3)
0
Sai

Sai

NA 114 3.9k 7y
its not working..
 
pls modified the below code.Here i choose jquery bootstrap datepicker.
 
$("#startdate").datepicker({
format: 'dd/mm/yyyy',
changeMonth: true,
changeYear: true,
});
$("#enddate").datepicker({
format: 'dd/mm/yyyy',
changeMonth: true,
changeYear: true,
});
Requriement:
===========
StartDate: 12/Jan/2015
EndDate: 13/Jan/2015 or next day , month,year.
enddate should not less than startdate.
0
Mukesh Nayak

Mukesh Nayak

NA 1.5k 317.4k 7y
Hi Sai,
 
I thik we can try as follwing :
  1. <p> Start Date: <input type="text" id="startDatepicker"></p>  
  2.  <p> End Date: <input type="text" id="endDatepicker"></p>  
  3.   
  4.   
  5.  <script>  
  6.         $(function () {  
  7.             $("#endDatepicker").datepicker('disable');  
  8.             $("#startDatepicker").datepicker({  
  9.                 onSelect: function (dateText, inst) {  
  10.                     var selDate = $(this).val();  
  11.                     $("#endDatepicker").datepicker({ minDate: selDate });  
  12.                 }  
  13.             });  
  14.               
  15.         });  
  16.     </script>  
 
0
Amit Kumar

Amit Kumar

NA 3.5k 203.6k 7y
Hi,
 
Use below code inside in datepicker class and then try like.
 
Exp:
 
$("#enddate").datepicker({
format: 'dd/mm/yyyy',
changeMonth: true,
changeYear: true,
yearRange: "-100:+0",
autoclose: true,
todayHighlight: true,
});
 
Regards,
Amit