Am 09.04.2010 15:33, schrieb Dave Rolsky:
On Thu, 8 Apr 2010, Carl Mäsak wrote:

I do want to explicitly credit Dave Rolsky, whose work on the DateTime
family of modules on CPAN has informed much of the current spec,
sometimes to the point of verbatim copying.

Thanks, but I'd hate to see you copy all my mistakes too!

One thing I think is really important is to offer a Date-only object
without a time component.

The lack of such an object in Perl 5's DateTime family is a real
problem. If you're only interested in dates and date math, time and time
zones just muddies the water.

I fully agree. I found Date::Simple on CPAN to do exactly what I want if I want date-only arithmetic. Here's a short summary:

* Dates are constructed with today() or date('2010-04-09')
* Operations: Date - Date => Int, Date + Int => Date, Date - Int => Date. Also ++ and -- are defined for Date objects. (In Perl 6 that would Date.succ, Date.pred) * Date objects can be queried for year, month, day, day of week (maybe day of year too, not sure)
* Date objects stringify in the same format as accepted in the constructor.

That's it.

I hope to find the tuits to add such a type to the spec, and some additional constructors (like DateTime.Date or so).

Reply via email to