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 hourCorrection #13

Closed
Finnb8r opened this issue Apr 18, 2018 · 1 comment
Closed

Wrong hourCorrection #13

Finnb8r opened this issue Apr 18, 2018 · 1 comment

Comments

@Finnb8r
Copy link

Finnb8r commented Apr 18, 2018

Hi,
Great work and thanks for this clock !
It works great, but I have however noticed that with timezones that are over 9 hours offset, the hourCorrection is not working properly.
This issue can be reproduced with an hourCorrection of 12 (Pacific/Nauru for example).
The problem lies within the function numberCorrection on line 340 :

function numberCorrection(num){
    if(num !== '+0' && num !== ''){
        if(num.charAt(0) === '+'){
            //addNum
            return + num.charAt(1);
        }
        else{
            //subNum
            return - num.charAt(1);
        }
    }
    else{
        return 0;
    }
}

This will return 1 instead of 12.
Fix would be to replace num.charAt(1) with num.substr(1) to return the correct number.

@thooyork
Copy link
Owner

Thanks for pointing that out !
Have fun with the clock plugin. If you use it on a public project a link or mention would be nice !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants