localzone 0.3.1

figures out the local timezone as IANA / Olson identifier
Documentation
1
2
3
4
5
6
7
8
9
use js_sys::Intl::DateTimeFormat;
use js_sys::Reflect;

pub fn get_local_zone() -> Option<String> {
    let opts = DateTimeFormat::default().resolved_options();
    Reflect::get(&opts, &"timeZone".into())
        .ok()
        .and_then(|x| x.as_string())
}