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

timezone spoof for date.parse throws NaN #583

Open
Thorin-Oakenpants opened this issue Jun 1, 2024 · 2 comments
Open

timezone spoof for date.parse throws NaN #583

Thorin-Oakenpants opened this issue Jun 1, 2024 · 2 comments

Comments

@Thorin-Oakenpants
Copy link

STR

example

https://github.com/arkenfox/TZP/blob/43c20737b4aeeeef4f2b119c89087a2223c7485e/js/region.js#L873-L901

@sereneblue
Copy link
Owner

Thanks for reporting @Thorin-Oakenpants.

It seems this is caused when a date pre-modern timezones is used. I have to do some further review to see what's the best way to handle those dates.

@Thorin-Oakenpants
Copy link
Author

Thorin-Oakenpants commented Jun 9, 2024

there's a lot more going on - e.g. even when not specifying spoof language, you modify the resolved locale for Intl.DateTimeFormat to en-US - at odds with all the rest (if you are not en-US of course)

IANAE on your code or webextensions, but you can simply pass undefined as the locale and timezone as the timeZone - for all the Intl and for toLocaleString and toLocaleDateString

edit: and when spoofing as e.g. Russian, nothing changes with navigator.language(s) to match, and locales are left alone: I'm not sure what your strategy is here, it's all so paradoxical :)

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