summaryrefslogtreecommitdiff
path: root/date.py
diff options
context:
space:
mode:
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>2006-08-15 14:05:19 +0200
committerNicolas Chauvat <nicolas.chauvat@logilab.fr>2006-08-15 14:05:19 +0200
commit4d59831d47ba0298059feb1a84d6b07fdceefaba (patch)
treeec4508f4bdae9661fbc28c99b798d702dc95ead5 /date.py
parent09d1ca2a469a985e450ba3f2ce98854ff99f1c07 (diff)
downloadlogilab-common-4d59831d47ba0298059feb1a84d6b07fdceefaba.tar.gz
define common.date.endOfMonth to make it easier to count months
Diffstat (limited to 'date.py')
-rw-r--r--date.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/date.py b/date.py
index 32474cb..7de6492 100644
--- a/date.py
+++ b/date.py
@@ -16,26 +16,22 @@
"""date manipulation helper functions"""
+from mx.DateTime import RelativeDateTime
+
+endOfMonth = RelativeDateTime(months=1,day=-1)
def date_range(begin, end, step=1):
"""
enumerate dates between begin and end dates.
step can either be oneDay, oneHour, oneMinute, oneSecond, oneWeek
- use RelativeDateTime(months=1,day=-1) to enumerate months
+ use endOfMonth to enumerate months
"""
date = begin
while date < end :
yield date
date += step
-# def enum_months(begin, end, day=1):
-# klass = type(begin)
-# date = begin
-# while date < end:
-# yield date
-# date = RelativeDateTime(months=+1)
-
FRENCH_FIXED_HOLIDAYS = {
'jour_an' : '%s-01-01',
'fete_travail' : '%s-05-01',