walrus
walrus copied to clipboard
Make time tests time-zone-independent
@kagd added a test for 0600 in #28, but it would be great if we didn't have to deal with that BS.
We can probably just convert the time that is being passed to UTC time since that will remain constant.
The tricky part with this one is that we typically don't want to display UTC to the user; it'll more likely be in their local time zone. So, what would be nice is to always have the test suite run in a specific time zone (doesn't matter which one).
I was thinking something like https://github.com/vesln/timekeeper might be of use here. Freeze time in a certain zone before the time-dependent tests.
Good point. I will try that out and see if I can get something working.