| Crates.io | ms-rs |
| lib.rs | ms-rs |
| version | 0.1.0 |
| created_at | 2024-06-03 15:36:31.662706+00 |
| updated_at | 2024-06-03 15:36:31.662706+00 |
| description | A Rust library that replicates the ms package from TypeScript for Rust. |
| homepage | https://github.com/smartarray/ms-rs |
| repository | https://github.com/smartarray/ms-rs |
| max_upload_size | |
| id | 1260224 |
| size | 8,741 |
ms-rs is a Rust library that recreates the ms package from TypeScript for Rust. It helps you convert milliseconds to human-readable time strings and vice versa. If you need to work with time in your Rust project, ms-rs makes it easy.
⏳ Convert time strings (like "2 days") to milliseconds. ⏱️ Convert milliseconds to time strings. ⏲️ Supports common time units like seconds, minutes, hours, and days. 👍 Easy-to-use API based on the ms package from TypeScript.
Add ms-rs to your Cargo.toml:
[dependencies]
ms-rs = "0.1.0"
Then use it in your code:
use ms_rs::ms;
fn main() {
let ms = ms("2 days").unwrap();
println!("{}", ms); // Outputs: 172800000
let time_str = ms(172800000);
println!("{}", time_str); // Outputs: "2 days"
}
Contributions are welcome! Check the CONTRIBUTING.md file for more info.
This project is licensed under the MIT License. See the LICENSE file for details.