Skip to main content

Crate philiprehberger_date_utils

Crate philiprehberger_date_utils 

Source
Expand description

Date and time utilities — business days, date ranges, holiday calendars, and formatting shortcuts.

§Example

use philiprehberger_date_utils::DateRange;
use chrono::NaiveDate;

let start = NaiveDate::from_ymd_opt(2026, 1, 1).unwrap();
let end = NaiveDate::from_ymd_opt(2026, 1, 31).unwrap();
let range = DateRange::new(start, end);

Structs§

DateRange
An inclusive date range from start to end.
NoHolidayCalendar
A calendar with no holidays — only weekends are non-business days.
USFederalCalendar
US Federal holiday calendar with weekend adjustment rules.

Traits§

HolidayCalendar
A calendar that can report which dates are holidays.

Functions§

add_business_days
Add (or subtract) business days to a date, skipping weekends and holidays.
business_days_between
Count the number of business days between start (inclusive) and end (exclusive).
end_of_month
Returns the last day of the month containing date.
end_of_quarter
Returns the last day of the quarter containing date.
fiscal_year
Returns the fiscal year for a given date with a custom fiscal-year start month.
format_iso
Format a date as “2026-03-19”.
format_long
Format a date as “March 19, 2026”.
format_short
Format a date as “Mar 19, 2026”.
is_business_day
Returns true if the date is a business day (not a weekend, not a holiday).
next_business_day
Returns the next business day strictly after date.
quarter
Returns the quarter (1-4) for the given date.
start_of_month
Returns the first day of the month containing date.
start_of_quarter
Returns the first day of the quarter containing date.
years_between
Returns the number of full years between two dates (age-style calculation).