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

Invalid local timezone in WASM #589

Closed
nitnelave opened this issue Aug 31, 2021 · 4 comments
Closed

Invalid local timezone in WASM #589

nitnelave opened this issue Aug 31, 2021 · 4 comments
Labels
API-incompatible Tracking changes that need incompatible API revisions

Comments

@nitnelave
Copy link

Hello,

I'm using chrono in WASM. My local timezone is UTC+2, but I get the same string twice when running this code:

let date : chrono::DateTime<Utc> = ...;
println!("{}", date);
println!("{}", date.with_timezone(&chrono::Local));

It seems that the local timezone is wrong when running in WASM. I tried both on Chrome and Firefox. I'm on Linux if it's relevant. I'm using chrono 0.4.19.

@CryZe
Copy link
Contributor

CryZe commented Aug 31, 2021

Did you activate the wasmbind feature?

@nitnelave
Copy link
Author

That was indeed the issue. Should there be a compilation warning, or a panic when using the Local timezone without this feature? Rather than doing the wrong thing silently.

@mfreeborn
Copy link

Just ran into this same issue, and I can confirm that the behaviour is rectified with the use of the wasmbind feature, with an essentially identical set up to OP.

It's slightly peculiar, because I'm sure it was showing the correct offset a few days/couple of weeks ago...

Anyway, I agree that some sort of warning would be better than silently producing the wrong behaviour. I'm not sure how this could be programatically detected, though.

@djc djc added the API-incompatible Tracking changes that need incompatible API revisions label May 10, 2022
@pitdicker
Copy link
Collaborator

The wasmbind feature is enabled by default since #771.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API-incompatible Tracking changes that need incompatible API revisions
Projects
None yet
Development

No branches or pull requests

5 participants