diff options
author | Nicolas Chauvat <nicolas.chauvat@logilab.fr> | 2006-08-15 14:05:19 +0200 |
---|---|---|
committer | Nicolas Chauvat <nicolas.chauvat@logilab.fr> | 2006-08-15 14:05:19 +0200 |
commit | 4d59831d47ba0298059feb1a84d6b07fdceefaba (patch) | |
tree | ec4508f4bdae9661fbc28c99b798d702dc95ead5 /date.py | |
parent | 09d1ca2a469a985e450ba3f2ce98854ff99f1c07 (diff) | |
download | logilab-common-4d59831d47ba0298059feb1a84d6b07fdceefaba.tar.gz |
define common.date.endOfMonth to make it easier to count months
Diffstat (limited to 'date.py')
-rw-r--r-- | date.py | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -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', |