API
- class datedelta.Date(year: int, month: int, day: int)
Represents a date in the Gregorian calendar.
A
ValueErroris raised if the date is invalid at initialization.- yearint
The year. Can be positive or negative.
- monthint
An integer in the range [1, 12], where 1 represents January.
- dayint
The day of the given month, starting at 1.
- __sub__(other: Any) int
Calculate the difference between this date and another.
The difference is defined as the absolute number of days found in between the two dates, not including the dates themselves.
- _is_valid() bool
Return True if the date is a valid combination of year, month, and day in the Gregorian calendar, otherwise return False.
- classmethod from_isoformat(date_string: str, /, sep: str = '-') Date
Construct a date by parsing a string of the form
YYYY-MM-DD.A
ValueErroris raised if the string is invalid.- date_stringstr
The string to parse containing the date in isoformat.
- sepstr (optional)
The character used to delineate the numerical parts of the string. Default: “-“.