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

webui: Fix timezone detection #729

Merged
merged 2 commits into from Mar 27, 2021
Merged

webui: Fix timezone detection #729

merged 2 commits into from Mar 27, 2021

Conversation

dave14305
Copy link
Contributor

Ignore timezone text in parentheses which may include a dash in non-English languages and confuse the index logic.

Fixes RMerl#726

Ignore text in parentheses which may include a dash in non-English languages and confuse the index logic.

Fixes #726
@dave14305
Copy link
Contributor Author

You could also opt for the RegExp approach taken in John's fork.

john9527/asuswrt-merlin@f63f408

@RMerl
Copy link
Owner

RMerl commented Mar 27, 2021

Can you give me an example of the string that may trigger the issue?

@dave14305
Copy link
Contributor Author

See https://www.snbforums.com/threads/allways-the-same-issue-with-ntp.70175/#post-662399

And Tue Mar 23 2021 14:58:29 GMT+0100 (közép-európai téli idő) from #726.
And Thu May 07 2020 22:28:01 GMT+0300 (Itä-Euroopan kesäaika) from https://www.snbforums.com/threads/timezone-difference-warning.63943/#post-580836

@RMerl RMerl merged commit 73e5ec9 into RMerl:master Mar 27, 2021
@dave14305 dave14305 deleted the patch-1 branch March 27, 2021 18:52
@gabortim
Copy link

Thank you!

Here is my version

function corrected_timezone() {
    let offsetString = "";
    const today = new Date();
    const offset = today.getTimezoneOffset();

    offsetString += offset <= 0 ? '+' : '-';                             // time zone offset sign
    offsetString += ((-1 * offset) / 60).toString().padStart(2, '0');    // hours
    offsetString += (Math.abs(offset) % 60).toString().padStart(2, '0'); // minutes

    if (timezone !== offsetString) {
        document.getElementById("timezone_hint_div").style.display = "";
        document.getElementById("timezone_hint").innerHTML = "* <#LANHostConfig_x_TimeZone_itemhint#>";
    }
}

RMerl pushed a commit that referenced this pull request May 13, 2021
Ignore text in parentheses which may include a dash in non-English languages and confuse the index logic.  For example:

"GMT+0300 (Itä-Euroopan kesäaika)"

Fixes #726
RMerl pushed a commit that referenced this pull request May 13, 2021
Ignore text in parentheses which may include a dash in non-English languages and confuse the index logic.  For example:

"GMT+0300 (Itä-Euroopan kesäaika)"

Fixes #726
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants