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
System's timezone isn't correctly recognized/handled #1029
Comments
Hi, I'm not sure what caused this wired error. I did not reproduce this error even if I changed my local timezone to "Europe/Berlin". There's one thing I could confirm is the test runs fine in my local timezone UTC+8 and the Travis CI unit test machine UTC 0. |
@iamkun have you tried running it with the specified configuration within the container? |
I don't know docker much. I've only updated my system timezone in "System preferences". |
Can you set the Travis CI to a different Timezone? Something like UTC+2 and check if tests still pass? |
We've already did this https://github.com/iamkun/dayjs/blob/dev/package.json#L9 But I will try UTC+2 later. |
I'm not 100% sure, but I don't think that actually changes the timezone of the system. I'd try setting it like:
or trying to run tests using the specified container. Moment and Luxon seem to respect the system timezone correctly, while I had no luck with dayjs. Incidentally it works fine if system timezone is UTC, but I think it's indeed rather a coincidence than the desired behaviour. |
I'll close this issue since it's been a while since it's been opened. Feel free to reopen if you have updates on this |
@iamkun did you tried the repro above? |
Yes, but everything seems all right |
Well, I get following result:
with current master. |
@Bessonov Yes, finally I can reproduce it after changing the macOS system's timezone. This might be a bug. |
I don't know if it's linked by this bug, but i encountered a problem when i try to setup timezone with jest tests : On jest.setup.js :
TypeError: Intl.DateTimeFormat(...).resolvedOptions is not a function jest test are launched with |
@antoninmorvan Did you import the plugins for
|
Hi, @amberfrontend I'm getting the same trouble when testing in docker, I tried your idea and I got in these topic of the documentation
It looks like that using UPDATE:
This should probably force the timezone in the test that you're running, so if you use |
Describe the bug
While working with dayjs and the timezone plugin I've noticed incorrect handling of timezones. Checking out the repository and running tests locally in a container results in some tests failing, which I suppose is the reason for the bug I've encountered in development under Node 12.18.0
Expected behavior
Tests passing.
Information
docker-compose.yml used to check out the repository:
Steps with complete logs:
The text was updated successfully, but these errors were encountered: