Last active
December 14, 2022 08:46
-
-
Save alksndrglk/3ef1eeef0643d2e02054363406761a48 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from datetime import date | |
| from dateutil.relativedelta import relativedelta | |
| from itertools import islice | |
| def payment_day(start, period=1): | |
| last_payment_day = start | |
| while True: | |
| next_payment_day = last_payment_day + relativedelta(months=period) | |
| yield next_payment_day.strftime("%d-%m-%Y") | |
| last_payment_day = next_payment_day | |
| if __name__ == "__main__": | |
| today = date.today() | |
| date_gen = payment_day(today) | |
| for i in islice(date_gen, 10): | |
| print(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment