[Erp5-report] r37031 yusei - /erp5/trunk/products/ERP5Type/DateUtils.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Sat Jul 10 09:19:43 CEST 2010
Author: yusei
Date: Sat Jul 10 09:19:42 2010
New Revision: 37031
URL: http://svn.erp5.org?rev=37031&view=rev
Log:
Result for August and September was wrong.
Hardcoding numbers is more simple and reliable.
Modified:
erp5/trunk/products/ERP5Type/DateUtils.py
Modified: erp5/trunk/products/ERP5Type/DateUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DateUtils.py?rev=37031&r1=37030&r2=37031&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DateUtils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/DateUtils.py [utf8] Sat Jul 10 09:19:42 2010
@@ -480,18 +480,25 @@ def createDateTimeFromMillis(millis):
def getNumberOfDayInMonth(date):
month = date.month()
- if month < 10 and month != 2:
- if month % 2 == 0:
- return 30
- return 31
- elif month >=10 and month != 2:
- if month % 2 == 0:
- return 31
- return 30
- else:
+ mapping = {
+ 1:31,
+ 3:31,
+ 4:30,
+ 5:31,
+ 6:30,
+ 7:31,
+ 8:31,
+ 9:30,
+ 10:31,
+ 11:30,
+ 12:31
+ }
+ if month == 2:
if date.isLeapYear():
return 29
return 28
+ else:
+ return mapping[month]
def atTheEndOfPeriod(date, period):
"""
More information about the Erp5-report
mailing list