Add duration to the instance. :param years: The number of years :param months: The number of months :param weeks: The number of weeks :param days: The number of days
(
self, years: int = 0, months: int = 0, weeks: int = 0, days: int = 0
)
| 185 | # ADDITIONS AND SUBTRACTIONS |
| 186 | |
| 187 | def add( |
| 188 | self, years: int = 0, months: int = 0, weeks: int = 0, days: int = 0 |
| 189 | ) -> Self: |
| 190 | """ |
| 191 | Add duration to the instance. |
| 192 | |
| 193 | :param years: The number of years |
| 194 | :param months: The number of months |
| 195 | :param weeks: The number of weeks |
| 196 | :param days: The number of days |
| 197 | """ |
| 198 | dt = add_duration( |
| 199 | date(self.year, self.month, self.day), |
| 200 | years=years, |
| 201 | months=months, |
| 202 | weeks=weeks, |
| 203 | days=days, |
| 204 | ) |
| 205 | |
| 206 | return self.__class__(dt.year, dt.month, dt.day) |
| 207 | |
| 208 | def subtract( |
| 209 | self, years: int = 0, months: int = 0, weeks: int = 0, days: int = 0 |
no test coverage detected