parmarmayur9090 / jquery-datepicker

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

2 digit year (i.e. MMM-dd-yy) handling #263

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When handling 2 digit years, the datepicker is selecting 1911 instead of 2011.

Is there a way to correctly set the first possible date to 2000 instead of 1900 
so that it will handle this correctly?

Is there a list of compatible dateformats anywhere?

Original issue reported on code.google.com by alexjasc...@gmail.com on 17 Feb 2011 at 10:03

GoogleCodeExporter commented 8 years ago
More information - this only seems to occur when setting startDate.

Original comment by alexjasc...@gmail.com on 17 Feb 2011 at 10:06

GoogleCodeExporter commented 8 years ago
Even forcing in 'year' doesnt seem to correct behaviour;
<script type="text/javascript">
  jQuery(function()
  {
    Date.format = 'mmm-dd-yy'
    jQuery('.date-pick').datePicker({
        clickInput:true,
        createButton:false,
        showYearNavigation:false,
        startDate:'Feb-17-01',
        year:2011,
        verticalOffset:0,
        horizontalOffset:0
    });
  });
</script>

Original comment by alexjasc...@gmail.com on 17 Feb 2011 at 10:17

GoogleCodeExporter commented 8 years ago
I'll try to take a look into it... 

As a quick workaround, what happens if you set start date after initialising 
the date picker? e.g.

jQuery(function()
  {
    Date.format = 'mmm-dd-yy'
    jQuery('.date-pick').datePicker({
        clickInput:true,
        createButton:false,
        showYearNavigation:false,
        year:2011,
        verticalOffset:0,
        horizontalOffset:0
    }).dpSetStartDate('Feb-17-01');
  });

And what happens with a different date format?

Original comment by kelvin.l...@gmail.com on 17 Feb 2011 at 4:56

GoogleCodeExporter commented 8 years ago
I tried this;

<script type="text/javascript">
  jQuery(function()
  {
    Date.format = 'mmm-dd-yy'
    jQuery('.date-pick').datePicker({
        clickInput:true,
        createButton:false,
        showYearNavigation:false,
        year:2011,
        verticalOffset:0,
        horizontalOffset:0
    }).dpSetStartDate('Feb-18-11');
  });
</script>

, and it will on 1st click select 2011 as the year. However when I select a 
date, and click again, its back to defaulting to 1911.

Original comment by alexjasc...@gmail.com on 18 Feb 2011 at 12:58

GoogleCodeExporter commented 8 years ago
And with a different Date.format?

Original comment by kelvin.l...@gmail.com on 18 Feb 2011 at 1:59