-
Notifications
You must be signed in to change notification settings - Fork 21
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
fix: force utc when converting DateTime values #66
base: main
Are you sure you want to change the base?
Conversation
DateTime always defaults to local time and needs to be explicitly converted to utc. Signed-off-by: Samuel Meenzen <[email protected]>
Oh damn, I didn't realize I was testing in a container where timezone is UTC. I'm gonna try to wrap my head aroud this next week. |
Yeah this seems like a major oversight of GitHub Actions. Really makes you wonder how many timezone related issues remained undetected because of this. |
IMO its better to keep bindings layer simple, and don't adjust On the other hand, adjusting for timezone would ensure Rust library always gets UTC-0 date-time. It seems difficult to choose the correct behaviour without a specific use case. I'm gonna check how this works in other bindings implementations - Swift, Kotlin, Python, Go. Timezone can be changed in Docker container with this command, it changes timezone to UTC+2:
|
Ok, so after taking a closer look at this after these few months break, I made another observation while tinkering around with your changes. It looks like It's possible to make |
I really don't like how DateTime woorks in C#, it always causes headaches. For that exact reason I always try to use DateTimeOffset where possible. Everywhere else I just use UTC DateTime. If we want keep using DateTime here, please add a documentation comment that indicates the type of the returned DateTime objects. |
I didn't know about |
Alternative to #65
As far as I understand we need to pass UTC values to rust anyway, so by forcing UTC both ways we can avoid confusion and user error.