[issue14423] Getting the starting date of iso week from a week number and a year.

Esben Agerbæk Black report at bugs.python.org
Tue Apr 10 11:48:20 CEST 2012


Esben Agerbæk Black <esbenab at gmail.com> added the comment:

I believe that it is a good solution to have, for lack of a better term;
bi-directional features so
in my opinion .isocalendar()  merits having a constructor that takes an ISO
format.

Sadly no :-(
I looked it over once more and it seems there is an error where the date is
not offset correctly
for years beginning on Tuesday, Wednesday or Thursday.
I will updater my patch ASAP.

+        if self.isocalendar()[1] != 1:
+            if self.weekday() > 3:  # Jan 1 is not in week one

+                 self += timedelta(7 - self.weekday())

+        else:

+            self -= timedelta(self.weekday())

----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue14423>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14423>
_______________________________________


More information about the Python-bugs-list mailing list