Nim: Support for more timezones in times module

Created on 25 Mar 2020  路  4Comments  路  Source: nim-lang/Nim

Summary

Add more timezones to times module including EST

Description

The times module currently supports UTC and will generate times in your local timezone. However, most applications will need to handle dates/times in many timezones, including parsing ones coming from external sources and displaying times in various timezones.

Alternatives

  • GULPF/timezones library

    • Haven't used it yet but it might have what I need as a stopgap. Ultimately, timezone support seems like a necessary part of a times standard library.

Additional Information

Times

Most helpful comment

The times module does support arbitrary timezones, but like you say it only provides timezone definitions for UTC and the local timezone. I implemented the timezone definitions as a nimble package package both to avoid bloating the stdlib and to avoid the issues of shipping something that eventually becomes outdated as part of Nim (the timezone definitions are not static, every year there are some minor changes).

If you do use the timezones package, please report any issues and feedback you have :) I haven't updated it in a while, but it's not abandoned.

All 4 comments

The times module does support arbitrary timezones, but like you say it only provides timezone definitions for UTC and the local timezone. I implemented the timezone definitions as a nimble package package both to avoid bloating the stdlib and to avoid the issues of shipping something that eventually becomes outdated as part of Nim (the timezone definitions are not static, every year there are some minor changes).

If you do use the timezones package, please report any issues and feedback you have :) I haven't updated it in a while, but it's not abandoned.

@narimiran please add GUPLF/timezones to important packages and then we can close this issue.

@GULPF tried out timezones and haven't seen any gaps or issues - it works well. You've convinced my why it shouldn't be in stdlib.

Let me suggest adding doc references to GULPF/timezones in many places. Personally, I don't know where 'important packages' is so I'd probably not even see it. Timezones are so important to real world business applications that, If it were my choice, I'd add a link in the standard times module documentation pointing to GULPF/timezones.

please add GUPLF/timezones to important packages and then we can close this issue.

This has now happened, closing

Was this page helpful?
0 / 5 - 0 ratings