validate_dates: Validate and Coerce Date Range Arguments

View source: R/validate.R

validate_datesR Documentation

Validate and Coerce Date Range Arguments

Description

Checks that start_date and end_date are a valid pair, coerces them to Date, and handles the case where both are NULL. When both are NULL and use_default_range = TRUE, a default range spanning from two years ago to one year ago is applied and reported to the user.

Usage

validate_dates(start_date, end_date, use_default_range = FALSE)

Arguments

start_date

A scalar coercible to Date via as.Date(), or NULL.

end_date

A scalar coercible to Date via as.Date(), or NULL.

use_default_range

A logical scalar. If TRUE and both date arguments are NULL, a default range spanning from two years ago to one year ago is used instead of returning NULL. Defaults to FALSE.

Value

A named list with elements start_date and end_date, both of class Date (or NULL when no dates are provided and use_default_range = FALSE).

See Also

Other utility functions: create_summary_statistics(), get_available_huggingface_files(), list_supported_datasets(), list_supported_datasets_ff(), list_supported_datasets_ff_legacy(), list_supported_datasets_macro_predictors(), list_supported_datasets_other(), list_supported_datasets_pseudo(), list_supported_datasets_wrds(), list_supported_indexes(), list_tidy_finance_chapters(), open_tidy_finance_website(), trim(), winsorize()


tidyfinance documentation built on June 1, 2026, 1:06 a.m.