I would like to create a setter method for a datetime object so that I can customize the replace method. Is this possible?
For example:
datetime = datetime.replace(day = 34)
This throws an error because 34 is not a valid number of days for any month, but what I would like to do is increase the month by 1 and then subtract 28, 30, or 31 days.
You can subclass
datetimeand provide your own implementation of thereplacemethod.