| 585 | |
| 586 | |
| 587 | class YearEnd(YearOffset): |
| 588 | _freq = "YE" |
| 589 | _day_option = "end" |
| 590 | _default_month = 12 |
| 591 | |
| 592 | def onOffset(self, date) -> bool: |
| 593 | """Check if the given date is in the set of possible dates created |
| 594 | using a length-one version of this offset class.""" |
| 595 | return date.day == date.daysinmonth and date.month == self.month |
| 596 | |
| 597 | def rollforward(self, date): |
| 598 | """Roll date forward to nearest end of year""" |
| 599 | if self.onOffset(date): |
| 600 | return date |
| 601 | else: |
| 602 | return date + YearEnd(month=self.month) |
| 603 | |
| 604 | def rollback(self, date): |
| 605 | """Roll date backward to nearest end of year""" |
| 606 | if self.onOffset(date): |
| 607 | return date |
| 608 | else: |
| 609 | return date - YearEnd(month=self.month) |
| 610 | |
| 611 | |
| 612 | class Day(BaseCFTimeOffset): |
no outgoing calls
no test coverage detected
searching dependent graphs…