https://bugzilla.wikimedia.org/show_bug.cgi?id=71124
Bug ID: 71124 Summary: Add ability to add/subtract months to/from pywikibot.Timestamp Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: enhancement Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: info@gno.de Web browser: --- Mobile Platform: ---
mw is able to calculate with parser variable #time e.g. to add or subtract months to the given time. python does not support it with standard libs and dateutils is not part of the framework. On the other hand it would be great to have such a feature calculating months with Timestamps.
https://bugzilla.wikimedia.org/show_bug.cgi?id=71124
Maarten Dammers maarten@mdammers.nl changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |maarten@mdammers.nl
--- Comment #1 from Maarten Dammers maarten@mdammers.nl --- Timestamp is a subclass of datetime.datetime. Can't we just use timedelta?
https://docs.python.org/2/library/datetime.html#timedelta-objects
This is what I did in newitem.py or do you want to do something else?
https://bugzilla.wikimedia.org/show_bug.cgi?id=71124
--- Comment #2 from xqt info@gno.de --- The problem is that months have different days between 28 an 31. Adding 1 month to 7th September should result in 7th October. Adding 7th October should give 7th November as result. dateutils does it. The highest timedelta resolution is "days" not "months". We could use constants from calendar module to implement it. I need it to calculate log entries. mw is able to calculate time stamps by adding months and years, whereas datetime objects aren't able to.
pywikipedia-bugs@lists.wikimedia.org