Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] ANNOUNCE: Library for handling Gregorian date calculations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] ANNOUNCE: Library for handling Gregorian date calculations
On Sun, Oct 24, 2004 at 04:31:59PM -0400, William Lovas wrote:
> On Sun, Oct 24, 2004 at 08:07:32PM +0100, Richard Jones wrote:
> > I'm pleased to announce GregorianDate, which is a pure Objective CAML
> > library for handling calculations on the Gregorian calendar.
> 
> This looks cool, but i have a few suggestions.  First, it needs some online
> documentation (beyond the examples), preferrably in ocamldoc format.

Yes, you're right, but I'm quite busy at the moment.  There is
ocamldoc documentation in the tarball itself, and for an online
reference you should look at:

http://search.cpan.org/dist/Date-Calc/Calc.pod#DESCRIPTION

The API is pretty much identical, except that I have omitted Steffen's
time functions which really don't belong in this library.

> In
> particular, the following examples weren't transparent to me (a date
> non-specialist):
> 
> > # business_of_standard (2004, 10, 24);;
> > - : (int * int) * int = ((2004, 43), 7)
[Sunday (7) in week 43 of year 2004.]
> > # nth_weekday_of_month (2004, 10) 7 4;;
> > - : int * int * int = (2004, 10, 24)
[Calculate the 4th Sunday (7) in October 2004.]
>
> I don't know what a "business" date is, and 10-24-2004 isn't a weekday.
> Actually, i think i just understood "nth_weekday_of_month", but
> documentation would certainly have been helpful.

For reference, business weeks are defined in ISO 8601, and you can
find a synopsis here:

http://www.cl.cam.ac.uk/~mgk25/iso-time.html

> > # day_of_week (2004, 10, 24);;
> > - : int = 7
> > etc.
> 
> Also, you might consider enriching the interface with some types: i'd say
> at least that day of the week ought to be a variant.  This not only makes
> thing safer, but also makes the intended behavior of functions like
> "nth_weekday_of_month" more apparent.

Rich.

-- 
Richard Jones.  http://www.annexia.org/  http://www.j-london.com/
>>>   http://www.team-notepad.com/ - collaboration tools for teams   <<<
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
Write Apache modules in OCaml - http://www.merjis.com/developers/mod_caml