pat2vec.util.parse_date

Functions

validate_input_dates(start_year, ...)

Validates start and end date components, accepting ints or strings.

pat2vec.util.parse_date.validate_input_dates(start_year, start_month, start_day, end_year, end_month, end_day)[source]

Validates start and end date components, accepting ints or strings.

This function converts all inputs to integers, checks if they form valid calendar dates, and formats the month/day with a leading zero if needed.

Parameters:
  • start_year (int or str) – The year of the start date.

  • start_month (int or str) – The month of the start date.

  • start_day (int or str) – The day of the start date.

  • end_year (int or str) – The year of the end date.

  • end_month (int or str) – The month of the end date.

  • end_day (int or str) – The day of the end date.

Returns:

(start_year, start_month, start_day, end_year, end_month, end_day).

Return type:

A tuple containing the formatted string values in the same order

Raises:

ValueError – If any input cannot be converted to an integer or if the date is invalid (e.g., month=13).