Crates.io | dotago |
lib.rs | dotago |
version | 0.1.0 |
source | src |
created_at | 2023-03-15 19:31:05.453799 |
updated_at | 2023-03-15 19:31:05.453799 |
description | syntactic sugar for time calculations |
homepage | https://github.com/orhanbalci |
repository | https://github.com/orhanbalci/dotago.git |
max_upload_size | |
id | 810930 |
size | 7,628 |
This crate is a rustlang port of dotago.js npm package written by @alexpusch.
[dependencies]
dotago = "0.1"
use dotago::Dotago;
// now: 2023-03-15T10:00:00Z
1.minute().ago().as_date(); // 2023-03-15T09:59:00Z
2.hours().ago().as_date(); // 2023-03-15T08:00:00Z
3.hours().from_now().as_date(); // 2023-03-15T13:00:00Z
use dotago::Dotago;
// now: 2020-06-18T10:00:00Z
1.minute().ago(); // 1592474340000
1.hour().ago(); // 1592470800000
1.hour().from_now(); // 1592478000000
use dotago::Dotago;
1.second(); // 1000
1.minute(); // 6000
1.hour(); // 3600000
use dotago::Dotago;
// now: 2020-06-18T10:00:00Z
(1.hour().ago() + 2.minutes()).as_date(); // 2020-06-18T09:02:00Z