Try comparing to http://jsbin.com/epuci/edit
On Fri, Jan 15, 2010 at 10:06 PM, Michael J. Sprague <mikespra...@gmail.com> wrote: > Thanks again, still no luck though. I copied and pasted your code exactly > and the second date picker still allows any date to be selected. > > > 2010/1/15 Balázs Suhajda <suhaj...@gmail.com> >> >> I think the problem with that is that you need the parse the date from >> the other input for which you can use the utility function >> $.datepicker.parseDate( format, value, settings ) >> >> I've tried the following and it sets the minDate properly: >> >> beforeShow: function(input) { >> var min = $("#startDate").val(); >> var format = $("#startDate").datepicker('option', 'dateFormat'); >> $(input).datepicker('option', 'minDate', >> $.datepicker.parseDate(format, min)); >> } >> >> On Fri, Jan 15, 2010 at 9:30 PM, Michael J. Sprague >> <mikespra...@gmail.com> wrote: >> > Thanks for the reply. I've been through the documentation several times >> > and >> > when I hard code a minDate and/or maxDate it seems to work fine but when >> > I >> > try to set it dynamically I'm having no luck. Here's some pared down >> > code to >> > give an example of what I'm trying to do: >> > >> > $("#startDate").datepicker(); >> > >> > $("#endDate").datepicker({ >> > beforeShow: function() { >> > $("#endDate").datepicker('option', 'minDate', new >> > Date($("#startDate").val())); >> > } >> > }); >> > >> > >> > 2010/1/15 Balázs Suhajda <suhaj...@gmail.com> >> >> >> >> Since you always have the other calendar's value available from an >> >> input, you can easily do all the math with it and the current date >> >> before rendering each day on the currently open calendar taking >> >> advantage of the beforeShowDay event: >> >> http://jqueryui.com/demos/datepicker/#event-beforeShowDay >> >> >> >> On Fri, Jan 15, 2010 at 5:28 PM, Michael J. Sprague >> >> <mikespra...@gmail.com> wrote: >> >> > I need to have two datepickers, one for a start date and one for an >> >> > end >> >> > date. I currently have them set up and working but I now need to >> >> > restrict >> >> > the selectable dates. The end date can never be greater than the >> >> > current >> >> > date and the user should never be able to select more than a 30 days >> >> > range >> >> > either forward from the start sate or backwards from the end date. >> >> > I've >> >> > done >> >> > some googling and found options that were close but nothing that >> >> > worked >> >> > the >> >> > way I needed it to. Does anyone have any sample code that will help >> >> > me >> >> > accomplish this? >> >> > >> >> > Thanks in advance, >> >> > >> >> > Mike >> >> > >> >> > -- >> >> > You received this message because you are subscribed to the Google >> >> > Groups >> >> > "jQuery UI" group. >> >> > To post to this group, send email to jquery...@googlegroups.com. >> >> > To unsubscribe from this group, send email to >> >> > jquery-ui+unsubscr...@googlegroups.com. >> >> > For more options, visit this group at >> >> > http://groups.google.com/group/jquery-ui?hl=en. >> >> > >> >> > >> >> >> >> >> >> >> >> -- >> >> Best regards, >> >> Balázs Suhajda >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> >> Groups >> >> "jQuery UI" group. >> >> To post to this group, send email to jquery...@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> jquery-ui+unsubscr...@googlegroups.com. >> >> For more options, visit this group at >> >> http://groups.google.com/group/jquery-ui?hl=en. >> >> >> >> >> >> >> > >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "jQuery UI" group. >> > To post to this group, send email to jquery...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > jquery-ui+unsubscr...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/jquery-ui?hl=en. >> > >> > >> >> >> >> -- >> Best regards, >> Balázs Suhajda >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jQuery UI" group. >> To post to this group, send email to jquery...@googlegroups.com. >> To unsubscribe from this group, send email to >> jquery-ui+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/jquery-ui?hl=en. >> >> >> > > > -- > You received this message because you are subscribed to the Google Groups > "jQuery UI" group. > To post to this group, send email to jquery...@googlegroups.com. > To unsubscribe from this group, send email to > jquery-ui+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/jquery-ui?hl=en. > > -- Best regards, Balázs Suhajda
-- You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to jquery...@googlegroups.com. To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.