Commit a5cb51a0 authored by Yusei Tahara's avatar Yusei Tahara

Result for August and September was wrong.

Hardcoding numbers is more simple and reliable.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37031 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7a994b1a
...@@ -480,18 +480,25 @@ def createDateTimeFromMillis(millis): ...@@ -480,18 +480,25 @@ def createDateTimeFromMillis(millis):
def getNumberOfDayInMonth(date): def getNumberOfDayInMonth(date):
month = date.month() month = date.month()
if month < 10 and month != 2: mapping = {
if month % 2 == 0: 1:31,
return 30 3:31,
return 31 4:30,
elif month >=10 and month != 2: 5:31,
if month % 2 == 0: 6:30,
return 31 7:31,
return 30 8:31,
else: 9:30,
10:31,
11:30,
12:31
}
if month == 2:
if date.isLeapYear(): if date.isLeapYear():
return 29 return 29
return 28 return 28
else:
return mapping[month]
def atTheEndOfPeriod(date, period): def atTheEndOfPeriod(date, period):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment