Return the date from the given delta :param date: The original date :param delta: The change from the original date that is to be calculated.
(date, delta)
| 65 | |
| 66 | @staticmethod |
| 67 | def monthdelta(date, delta): |
| 68 | """ |
| 69 | Return the date from the given delta |
| 70 | |
| 71 | :param date: The original date |
| 72 | :param delta: The change from the original date that is to be calculated. |
| 73 | """ |
| 74 | m, y = (date.month + delta) % 12, date.year + ((date.month) + delta - 1) // 12 |
| 75 | if not m: |
| 76 | m = 12 |
| 77 | d = min( |
| 78 | date.day, |
| 79 | [ |
| 80 | 31, |
| 81 | 29 if y % 4 == 0 and not y % 400 == 0 else 28, |
| 82 | 31, |
| 83 | 30, |
| 84 | 31, |
| 85 | 30, |
| 86 | 31, |
| 87 | 31, |
| 88 | 30, |
| 89 | 31, |
| 90 | 30, |
| 91 | 31, |
| 92 | ][m - 1], |
| 93 | ) |
| 94 | return date.replace(day=d, month=m, year=y) |
| 95 | |
| 96 | def insert_record(self, result, source_name, source_metadata=None): |
| 97 | """ |
no outgoing calls
no test coverage detected