On 22 dec., 15:18, "Richard D. Worth" <[email protected]> wrote:
> This would be a good start:
>
> http://groups.google.com/group/jquery-ui/browse_thread/thread/2a8b9ff...
>
> You'll just have to modify that to add 3 days.
>
> - Richard
>
>
>
> On Mon, Dec 21, 2009 at 4:56 PM, Aljaz <[email protected]> wrote:
> > Hello,
>
> > Hope someone can help me.. I am still new to jquery and i like to ask
> > and learn :). Well i need help with datepicker. I have 2 inputs witch
> > both triger datepicker. I need the "date from" value from the first
> > datepicker and insert it to "date to" into the minDate. I need to do a
> > minimal reservation days and would like to simply solve it with
> > jquery. So for example "date from" is picked 1/1/2010 and i need 3
> > days minimal reservation, so if 1/1/2010 was picked i need the value
> > of it and combine it with the minDate in "date to" so the minDate for
> > "date to" would be 10/1/2010, another example : if "date from" is
> > picked 10/1/2010 then "date to" minDate should be 13/1/2010. Please
> > help !
>
> > Here is the code:
>
> > /* Function date from */
> > $(function() {
> > $('#startdate').datepicker({
> > minDate: 0,
> > dateFormat: 'dd-mm-yy',
> > changeMonth: true,
> > changeYear: true
> > });
>
> > /* Function date to */
> > $('#enddate').datepicker({
> > minDate: 3, <------------------------------ here should be something
> > like: minDate: 3+ $datefrom,
> > dateFormat: 'dd-mm-yy',
> > changeMonth: true,
> > changeYear: true
> > });
>
> > <input id='startdate' name='start' size='15'/>
> > <input id='enddate' size='15' name='end'/>
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "jQuery UI" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<jquery-ui%2bunsubscr...@googlegroups
> > .com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/jquery-ui?hl=en.
Thank you for the link it works great but i have one more problem...
When i give +3 in the new date and when i choose like 27.12.09 then
the second datepicker goes to 30.13.2010 why is that ? Am i doing
something wrong if i give +3 at the inst.selectedDay+3 ?... What would
be better that the code correctly calculates the date... so if i put
in the first one 30.12.2009 that +3 day gives the date 2.1.2010...
here is the code :
$(function() {
$('#startdate').datepicker({
minDate:0,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy',
onSelect: function(dateText, inst) {
$('#enddate').datepicker('option','minDate', new Date
(inst.selectedYear, inst.selectedMonth, inst.selectedDay+3));
}
});
$('#enddate').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy',
onSelect: function(dateText, inst) {
$('#startdate').datepicker('option','maxDate' , new Date
(inst.selectedYear, inst.selectedMonth, inst.selectedDay+3));
}
});
--
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en.