Active Support is a collection of utility extensions for Rust inspired by activesupport of Ruby on Rails
Active Support is released under the MIT license:
```rust use activesupport::time::TimeDuration;
asserteq!(60.seconds(), Duration::seconds((60).into())); asserteq!(1.second(), Duration::seconds((1).into())); asserteq!(60.minutes(), Duration::minutes((60).into())); asserteq!(1.minute(), Duration::minutes((1).into())); asserteq!(60.hours(), Duration::hours((60).into())); asserteq!(1.hour(), Duration::hours((1).into())); asserteq!(60.days(), Duration::days((60).into())); asserteq!(1.day(), Duration::days((1).into())); asserteq!(60.weeks(), Duration::weeks((60).into())); asserteq!(1.week(), Duration::weeks((1).into())); asserteq!(60.fortnights(), Duration::weeks((120).into())); asserteq!(1.fortnight(), Duration::weeks((2).into())); ```
```rust use activesupport::time::TimeRange;
assert!(1.day().fromnow() <= Utc::now().checkedaddsigned(1.day().toowned())); assert!(2.weeks().fromnow() <= Utc::now().checkedaddsigned(2.weeks().toowned())); assert!( (4.days() + 5.weeks()).fromnow() <= Utc::now().checkedaddsigned((4.days() + 5.weeks()).toowned()) );
assert!(1.day().ago() <= Utc::now().checkedsubsigned(1.day().toowned())); assert!(2.weeks().ago() <= Utc::now().checkedsubsigned(2.weeks().toowned())); assert!( (4.days() + 5.weeks()).ago() <= Utc::now().checkedsubsigned((4.days() + 5.weeks()).to_owned()) ); ```