Timelib for Rust

Crates.io Build Status docs.rs Code Coverage Funding Status

Timelib for Rust is a small Rust wrapper around the timelib library that is used to power PHP and MongoDB.

Installation

Prerequisites:

timelib depends on re2c to be built. You can install it easily on all major platforms:

  1. Linux: apt-get install re2c
  2. Mac: brew install re2c
  3. Windows: choco install re2c
  4. From source: re2c.org

Now you can install with:

bash cargo add timelib

Usage

```rust strtotime("tomorrow".into(), None, None);

strtotime("next tuesday".into(), Some(1654318823), Some("America/Chicago".into())); ```

View the tests for more examples.

Building

Make sure to check out all submodules.

Initial clone:

bash git clone --recurse-submodules https://github.com/westy92/timelib-rust

Post-clone:

bash git submodule init && git submodule update

Make sure to install re2c as described above.

You should now be able to run cargo build and cargo test.