SankhaUI / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

start-date with no restriction, end-date only after start-date #372

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

What is the expected output? What do you see instead?

I need start-date to have no restriction, and end-date only be after start-date

Please provide a URL to a page displaying the problem.

What version of the datepicker are you using? On what operating system? And 
Which Browser?

Please provide any additional information below.

I want to set this up so the start-date can be any date in the past or future, 
but the end-date can only be after start-date.

Before I initialized the startDate (01/01/1900), it is working exactly the way 
I want, but after I set the startDate value, there is no more restriction on 
the end-date. 

This is the code I am using, any help is much appreciated

        Date.firstDayOfWeek = 0;
        Date.format = 'mm/dd/yyyy';
        $(function()
        {
          $('.date-pick').datePicker(
                {
                    startDate:'01/01/1900',
                }
            )
          $('#start-date').bind(
            'dpClosed',
            function(e, selectedDates)
            {
              var d = selectedDates[0];
              if (d) {
                d = new Date(d);
                $('#end-date').dpSetStartDate(d.addDays(1).asString());
              }
            }
          );
          $('#end-date').bind(
            'dpClosed',
            function(e, selectedDates)
            {
              var d = selectedDates[0];
              if (d) {
                d = new Date(d);
                $('#start-date').dpSetEndDate(d.addDays(-1).asString());
              }
            }
          );
        });

Original issue reported on code.google.com by ela...@gmail.com on 21 May 2013 at 3:29