Module dates

Source
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§

DatesGenerator
An iterator that generates a sequence of calendar dates based on a start date, frequency, and a specified number of periods.
DatesList
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§

AggregationType
Indicates whether the first or last date in a periodic group (like month, quarter) is selected for the frequency.
DateFreq
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).