Skip to content

gpgkd906/date_component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

date_component

calculate dates interval between 2 dates with shared timezone with chrono. and the calculation is also considered with DST if necessary.

API

https://gpgkd906.github.io/date_component/date_component/

Example

use chrono::prelude::*;
use date_component::date_component;

fn main() {
    let date1 = Utc.with_ymd_and_hms(2015, 4, 20, 0, 0, 0).unwrap();
    let date2 = Utc.with_ymd_and_hms(2015, 12, 19, 0, 0, 0).unwrap();
    
    let date_interval = date_component::calculate(&date1, &date2);
    println!("{:?}", date_interval);
}
// DateComponent { year: 0, month: 7, week: 4, modulo_days: 1, day: 29, hour: 0, minute: 0, second: 0, interval_seconds: 20995200, interval_minutes: 349920, interval_hours: 5832, interval_days: 243, invert: false }

Tests

Run tests with cargo test. see src/lib.rs.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages