From 06dc8d61a28ea22681a6bbef81a8d0886ae7c349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Fri, 2 Feb 2007 13:33:03 +0000 Subject: [PATCH] roundDate is useless git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12526 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/DateUtils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/product/ERP5Type/DateUtils.py b/product/ERP5Type/DateUtils.py index 7ac1c8f8e1..3788310e14 100644 --- a/product/ERP5Type/DateUtils.py +++ b/product/ERP5Type/DateUtils.py @@ -26,6 +26,8 @@ # ############################################################################## +import warnings + from AccessControl import ModuleSecurityInfo from DateTime import DateTime from zLOG import LOG @@ -254,8 +256,8 @@ def getAccountableYearFraction(from_date=None, to_date=None): Returns a year fraction according to accounting rules, i.e. 30 days per month """ - from_date = roundDate(from_date) - to_date = roundDate(to_date) + from_date = from_date.earliestTime() + to_date = to_date.earliestTime() months = getMonthAndDaysBetween(from_date, to_date)['month'] days = getMonthAndDaysBetween(from_date, to_date)['day'] @@ -332,4 +334,6 @@ def roundDate(date): """ Returns a date at 0:00 """ - return DateTime('%s/%s/%s' % (date.year(), date.month(), date.day())) + warnings.warn('ERP5Type.DateUtils.roundDate is deprecated, use' + ' DateTime.earliestTime instead', DeprecationWarning) + return date.earliestTime() -- 2.30.9