yearfrac
yearfrac is a rust crate used to calculate fraction of a year between two dates(chrono::NaiveDate).
Supports all five Excel's daycount conventions:
nasd30/360
act/act
act360
act365
eur30/360
Tested to match Excel's YEARFRAC function
Examples
use DayCountConvention;
use ;
let start = from_ymd;
let end = from_ymd;
let yf = from_int.unwrap
.yearfrac;
assert!;
let yf = from_str.unwrap
.yearfrac;
assert!;
use is_leap_year;
assert_eq!