rtz
A self-contained timezone library / binary / server for Rust / JS (via WASM) (free server).
Binary Usage
Install
Cargo:
NPM:
Help Docs
)
Resolve a Time Zone
)))
))
Generate the Cache Files
Library Usage
Add this to your Cargo.toml:
[]
= "*" #choose a version
Examples
use get_timezone;
// Query a time zone for a given `(lng,lat)`.
assert_eq!;
JS Usage
The npm package is available here.
First, load the module as you would any other ES module.
import * as rtz from 'rtzweb/rtzlib.js';
Then, you can use the library similarly as you would in Rust.
let tz = rtz.;
tz.; // "America/Los_Angeles"
Feature Flags
The library and binary both support various feature flags. Of most important note are:
default = ["cli"]cli: enables the CLI features, and can be removed if only compiling the library.wasm: enables the WASM features, and is required to build an NPM package viawasm-pack.server: enables theservesubcommand, which starts a Rocket web server that can respond to time zone requests.
Test
Bench
License
MIT