Expand description
Generation and manipulation of calendar date sequences.
use rustframe::utils::dateutils::dates::{DateFreq, DatesList};
let list = DatesList::new("2024-01-01".into(), "2024-01-03".into(), DateFreq::Daily);
assert_eq!(list.count().unwrap(), 3);
Structs§
- Dates
Generator - An iterator that generates a sequence of calendar dates based on a start date, frequency, and a specified number of periods.
- Dates
List - Represents a list of calendar dates generated between a start and end date at a specified frequency. Provides methods to retrieve the full list, count, or dates grouped by period.
Enums§
- Aggregation
Type - Indicates whether the first or last date in a periodic group (like month, quarter) is selected for the frequency.
- Date
Freq - Represents the frequency at which calendar dates should be generated.
Functions§
- find_
first_ date_ on_ or_ after - Finds the first valid date according to the frequency,
starting the search on or after the given
start_date
. - find_
next_ date - Finds the next valid date according to the frequency,
given the
current_date
(which is assumed to be a valid date previously generated). - get_
dates_ list_ with_ freq - Generates the flat list of dates for the given range and frequency.
Assumes the
collect_*
functions return sorted dates. - get_
dates_ list_ with_ freq_ from_ naive_ date - Returns a list of dates between the given start and end dates, inclusive,
at the specified frequency.
This function is a convenience wrapper around
get_dates_list_with_freq
. - group_
dates_ helper - month_
to_ quarter - Converts a month number (1-12) to a quarter number (1-4). Panics if month is invalid (should not happen with valid NaiveDate).