utils.py
branchstable
changeset 3851 3a18a0a24411
parent 3838 9cc134372bf8
child 3882 addc715f4fcd
--- a/utils.py	Sun Nov 15 13:58:33 2009 +0100
+++ b/utils.py	Mon Nov 16 08:58:35 2009 +0100
@@ -52,6 +52,13 @@
 def days_in_month(date_):
     return monthrange(date_.year, date_.month)[1]
 
+def days_in_year(date_):
+    feb = pydatetime.date(date_.year, 2, 1)
+    if days_in_month(feb) == 29:
+        return 366
+    else:
+        return 365
+
 def previous_month(date_, nbmonth=1):
     while nbmonth:
         date_ = first_day(date_) - ONEDAY