date-differencer 0.2.0

Calculate the time interval between two supported date-time values and output the result in years plus months plus days plus hours plus minutes plus seconds plus nanoseconds (instead of representing the same duration in different units). This library is useful for lifespan check and age calculation.
Documentation
use chrono::{DateTime, Datelike, NaiveDateTime, Timelike};

use super::DateTimeParts;

impl<Tz> DateTimeParts for DateTime<Tz>
where
    Tz: chrono::TimeZone,
    DateTime<Tz>: Ord,
{
    #[inline]
    fn year(&self) -> i32 {
        Datelike::year(self)
    }

    #[inline]
    fn month(&self) -> u8 {
        Datelike::month(self) as u8
    }

    #[inline]
    fn day(&self) -> u8 {
        Datelike::day(self) as u8
    }

    #[inline]
    fn hour(&self) -> u8 {
        Timelike::hour(self) as u8
    }

    #[inline]
    fn minute(&self) -> u8 {
        Timelike::minute(self) as u8
    }

    #[inline]
    fn second(&self) -> u8 {
        Timelike::second(self) as u8
    }

    #[inline]
    fn nanosecond(&self) -> u32 {
        Timelike::nanosecond(self)
    }
}

impl DateTimeParts for NaiveDateTime {
    #[inline]
    fn year(&self) -> i32 {
        Datelike::year(self)
    }

    #[inline]
    fn month(&self) -> u8 {
        Datelike::month(self) as u8
    }

    #[inline]
    fn day(&self) -> u8 {
        Datelike::day(self) as u8
    }

    #[inline]
    fn hour(&self) -> u8 {
        Timelike::hour(self) as u8
    }

    #[inline]
    fn minute(&self) -> u8 {
        Timelike::minute(self) as u8
    }

    #[inline]
    fn second(&self) -> u8 {
        Timelike::second(self) as u8
    }

    #[inline]
    fn nanosecond(&self) -> u32 {
        Timelike::nanosecond(self)
    }
}