Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong dates disabled. #543

Closed
kaylanx opened this issue Oct 15, 2014 · 3 comments
Closed

Wrong dates disabled. #543

kaylanx opened this issue Oct 15, 2014 · 3 comments
Labels

Comments

@kaylanx
Copy link

kaylanx commented Oct 15, 2014

I recently upgraded from pickadate 3.3.2 to 3.5.4 and now the wrong dates are being disabled, you can see from the screenshot:

captura de pantalla 2014-10-15 a la s 21 39 58

The dates I've tried to disable are the 18th and 26th of October amongst others, as you can see these dates are both available but the 17th and 25th are disabled instead.

I'm in the UK by the way I don't know if that has anything to do with it, with regards to locale etc.

Here is the code to replicate this issue...

<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>


<link id="theme_base" href="http://amsul.ca/pickadate.js/lib/themes/classic.css" rel="stylesheet" />
<link id="theme_date" href="http://amsul.ca/pickadate.js/lib/themes/classic.date.css" rel="stylesheet" />   
<link id="theme_time" href="http://amsul.ca/pickadate.js/lib/themes/classic.time.css" rel="stylesheet" />

<script src="http://amsul.ca/pickadate.js/lib/picker.js"></script>
<script src="http://amsul.ca/pickadate.js/lib/picker.date.js"></script>
<script src="http://amsul.ca/pickadate.js/lib/picker.time.js"></script>
<script src="http://amsul.ca/pickadate.js/lib/legacy.js"></script>
<script type="text/javascript">
    $(function() {

        var OCT = 9;
        var NOV = 10;
        var DEC = 11;

        $('.datepicker').pickadate({
            disable: [
                        new Date(2014,OCT,18),
                        new Date(2014,OCT,26),
                        new Date(2014,OCT,27),
                        new Date(2014,OCT,28),
                        new Date(2014,OCT,29),
                        new Date(2014,OCT,30),
                        new Date(2014,OCT,31),
                        new Date(2014,NOV,01),
                        new Date(2014,NOV,02),
                        new Date(2014,NOV,29),
                        new Date(2014,DEC,22),
                        new Date(2014,DEC,23),
                        new Date(2014,DEC,24),
                        new Date(2014,DEC,25),
                        new Date(2014,DEC,26)
                    ]
        });
    });
</script>

</head>
<body>

<input type="text" class="datepicker" />

</body>
</html>
@kaylanx
Copy link
Author

kaylanx commented Oct 15, 2014

captura de pantalla 2014-10-15 a la s 22 04 55

Could it be something to do with daylight savings time? It ends in the UK on the 26th.

@kaylanx
Copy link
Author

kaylanx commented Oct 17, 2014

It is to do with the change that was made to use UTC dates instead of the normal date. Locally i've changed all calls to getUTCxxx back to the non UTC versions and it's working fine.

This shows what happens in a UK Locale when we're in daylight savings time....

<html>
<head>
<script type="text/javascript">
    var OCT = 9
    var d = new Date(2014,OCT,18)
</script>
</head>
<body>
<br/>
getUTCDate(): <script>document.write(''+d.getUTCDate())</script>
<br/>
getDate(): <script>document.write(''+d.getDate())</script>
<br/>
</body>
</html>

The output of this html is...

getUTCDate(): 17 
getDate(): 18 

I can see that some work has been done to revert this change, but the latest code from the dev branch still doesn't work correctly.

@amsul amsul added the bug label Oct 26, 2014
@amsul
Copy link
Owner

amsul commented Dec 7, 2014

I appreciate the thorough report! Continuing the discussion here: #556

I pushed a fix to the master branch: https://github.com/amsul/pickadate.js/tree/master if you’d like to verify your issue has been resolved.

Cheers!

@amsul amsul closed this as completed Dec 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants