Closed siedentop closed 2 years ago
This might help.
let timezone = "Africa/Asmara";
timezone.parse::<chrono_tz::Tz>()
I'm open to having this, but I'd like to have TIMEZONES
be renamed to TIME_ZONES
(in a separate commit, please).
@djc like this, or renaming it everywhere? pub use timezones::TIMEZONES as TIME_ZONES;
EDIT: I just did the right thing, and renamed it everywhere.
Thanks for the rename! I'm having some second thoughts as this makes phf part of the public API. How about we wrap the phf::Map
in a newtype wrapper that exposes a minimal API (maybe just get()
and iter()
for now)?
Sorry for the delay. I've just discovered that TZ_VARIANTS
is already public and exported.
Here's what I want to do: chrono_tz::TZ_VARIANTS.iter().map(|x| x.to_string())
So, let's close this PR.
I could imagine, that this PR is not implemented in the way you'd prefer. I mostly want to get the conversation started and offer one possible implementation.
For a feature, I thought it would be nice to create an auto-correct dictionary for all known timezones.
So, in this PR I am changing
static TIMEZONES
topub static TIMEZONES
. On the user side, I am simply creating a list off all timezones like this:chrono_tz::TIMEZONES.keys().map(|x| x.to_string()).collect()
.Is this something you would be willing to support? Would you prefer a new function that hid the access to TIMEZONES behind a function?
Pinging previous authors of the modified file: @quodlibetor @petrosagg