Hi,

the DateTime family of modules, as far as I am aware of, still
lacks easily available business calendars.  In principle, one
could define holidays as recurring events an build loops counting
non-holidays on top of that, etc. etc., but that sounds tedious.

Some time ago I did something similar based on a simpler (to
me, at least) module, Date::Gregorian.  This module only deals
with dates, not dates and times, and has no great virtues other
date modules haven't, but maybe some of its ideas can finally
be incorporated in a DateTime plugin.

As a first step in that direction I added functionality to create
Date::Gregorian objects from DateTime objects and vice versa.

I have just uploaded version 0.10 of Date::Gregorian to CPAN
including this addition.  The Changes item of this release is
rather long as it was somewhat overdue:

0.10 Thu Jun 15 21:47:00 2007
  - replaced Date::Gregorian::Exact by a dummy croaking when imported
  - updated t/exact.t to reflect Date::Gregorian::Exact suspension
  - added DateTime interoperability
  - added methods get_string and set_string
  - added methods get_days_until and compare
  - added method get_localtime
  - added calendar example script
  - fixed a bug in get_ywd/check_ywd related to days late in December
  - fixed return value of set_weekday
  - revised documentation
  - upgraded META.yml to conform to spec v1.3
  - added checks in t/basic.t and t/business.t
  - added t/datetime.t, t/localtime.t and t/string.t
  - added t/pod-coverage.t

Date::Gregorian::Exact was a simplistic attempt to handle
timestamps that got thrown out on that occasion.

Date::Gregorian::Business is of course still in the bundle as
a subclass of Date::Gregorian.  This is where the business/holiday
stuff is anchored.

One idea I came up with is how ambiguities can be avoided that
tend to arise where time scales with holes (such as weekends and
holidays in the context of business calendars) are dealt with.
It is a concept I have called morning/evening alignment.

Business dates get an attribute "alignment" telling whether
they represent the beginning or the end of a business day.
Calculations yielding a new date can be forced to return values
with either one of the alignments.  The M/E alignment also
determines whether a particular day is counted when it is the
upper or lower limit of a duration.

I'll add some examples as soon as I get around to it.

Suggestions/questions/flames are welcome.

-Martin

Reply via email to