develooper Front page | perl.perl6.language | Postings from May 2005

Re: date and time formatting

Thread Previous | Thread Next
From:
Sam Vilain
Date:
May 31, 2005 20:43
Subject:
Re: date and time formatting
Message ID:
429D2EC1.1020204@vilain.net
Rob Kinyon wrote:
> What I'm trying to get at isn't that DateTime's API should be
> preserved. I'm saying that the concept of DateTime should be ported.
> Core or not core - it doesn't matter. When use'd (or installed), it
> should override now() (and anyone else we can think of) to return an
> object that DWIMs, plus provides the interface you've outlined below.

I've made a start on this.  See ext/Date in pugs.  I don't think that
your views are necessarily contrary.

The biggest reason I didn't use DateTime was that I found it awkward
for the common case; most of the time I just want to stuff in an
ISO8601 date.  I also don't like implicit normalisation to seconds
underneath the hood when I'm doing basic date calculations, and
the way that the "DateTime" base class is inherantly based on the
Gregorian calendar.

The "Date" and "Duration" roles are extremely minimal; see

    http://svn.openfoundry.org/pugs/ext/Date/lib/Date.pm
    http://svn.openfoundry.org/pugs/ext/Date/lib/Duration.pm

The major API is described at:

    http://svn.openfoundry.org/pugs/ext/Date/lib/Date/Gregorian.pod

This module is supposed to be somewhere between DateTime and
Class::Date, with built-in ISO-8601 support (as it's the standard ;)).

With a bit of luck, all Date implementation can share this `Date'
Role, and Gregorian calendar modules share the `Date::Gregorian' Role,
so that the multitude of implementations that crop up will be mutually
exchangable, and the simple case fast, efficient and useful.

Sam.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About