dotago
This crate is a rustlang port of dotago.js npm package written by @alexpusch.
📦 Cargo.toml
[]
= "0.1"
🔧 Example
Work with dates
use 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
Work with timestamps
use Dotago;
// now: 2020-06-18T10:00:00Z
1.minute.ago; // 1592474340000
1.hour.ago; // 1592470800000
1.hour.from_now; // 1592478000000
Duration in milliseconds
use Dotago;
1.second; // 1000
1.minute; // 6000
1.hour; // 3600000
Do math
use Dotago;
// now: 2020-06-18T10:00:00Z
.as_date; // 2020-06-18T09:02:00Z