[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Date/time package

John Cowan <cowan@x> writes:
> Peter Bex scripsit:
>> I think a comfortable, complete date/time-manipulation is one thing that
>> Scheme is sorely lacking.  We have SRFI-19, but it is a bit unwieldy and
>> not very complete.
> I have written up a proposal for WG2 which can be found at
> http://trac.sacrideo.us/wg/wiki/TimeAdvancedCowan , with a supplement
> on durations and intervals at http://trac.sacrideo.us/wg/wiki/TimePeriodsCowan .
> It's based loosely on the Java package JodaTime, but adapted to the nature
> of a dynamically typed language.  It is certainly comprehensive; how
> comfortable it is, is for others to judge.
> If anyone's interested, please take a look and comment here.

Fantastic.  I had begun writing a similar thing, but you're much further
along.  Maybe I can assist.

Question: what do you mean by the terms "julian" and "gregorian"?  These
terms are often thrown around without enough specificity.  There are
several variables that affect these calendars, depending on the
application, including:

  Julian proleptic calendar: backdates quadrennial leap years to dates
  before 4 AD, though historically, leap years were erratically applied
  between their introduction and that date.

  Gregorial proleptic calendar: backdates the gregorian reform to dates
  prior to its introduction.  I.e., the day before 1582-10-15 was
  1582-10-14 instead of the historical 1582-10-04.

  Astronomical year numbering: includes a year zero.  Used in astronomy.

As a general-purpose library, it would be nice for the user to be able
to specify all of these things, depending on the application.  (I have
genealogy and astronomy applications in mind.)

There is also the can of worms of when the gregorian reform was adopted
in different countries.  If a person wants to work with historical
dates, it would be important to be able to express these differences as
different chronologies.

On a related topic, formatting, there was some discussion in this thread
about how the ISO8601 is closely tied to its particular chronology.  I
don't personally see any problem with using ISO8601 format with other
chronologies than gregorian/gregorian-proleptic; indeed, it is a very
convenient format; parsing and validation can be completely separate.  I
wrote a parser for it in chicken, with regexps; it handles both basic
and extended format of single timestamps - it doesn't do durations,
intervals, or repeats yet.  It is parse-iso8601 near the top of
<http://retroj.net/git/calendar-egg/calendar.scm>; there is a suite of
tests in the repo as well.

John Foerch

Scheme-reports mailing list