More flexibly subtract/difference methods

2003-10-09 Thread Dave Rolsky
So there was some talk about this earlier and I was thinking about how best to make this information available. Currently, the default when subtracting datetimes is to break down the duration into multiple parts, months, days, minutes, seconds, and nanoseconds. >From the months piece we can deriv

DateTime::Set conditional offset, remove datetimes

2003-10-09 Thread fglock
DateTime::Set in cvs: =item * iterate Experimental method - subject to change. This method apply a callback subroutine to all elements of a set. sub callback { $_[0]->add( hours => 1 ); } # offset $set elements by one hour $set->iterate( \&callback ); # $set2 ele

Re: [Announce] DateTime-event-sunrise 0.0401 committed to CVS

2003-10-09 Thread fglock
Ronald Hill said: > > This will not preserve the class information, > I tried Flavio's suggestion of > > my $tmp_dt1 = $dt-> > clone-> > set_time_zone( 'UTC' )-> > truncate( to => 'day' ); > > instead of creating a new object however, > I was always getting the incorre

[Announce] DateTime-event-sunrise 0.0401 committed to CVS

2003-10-09 Thread Hill, Ronald
Hi All, I have just committed changes to the sunrise module for preserving the timezone information. I have to confess I do not like how I had to do it :( Here is how I have changed the _sunrise sub my $rise_time = $tmp_dt1 + $rise_dur; my $set_time = $tmp_dt1 + $set_dur; my $tz = $dt->ti

Re: [PATCH] Several fixes to DateTime::TimeZone 0.2503

2003-10-09 Thread Alexey Mahotkin
> "DR" == Dave Rolsky <[EMAIL PROTECTED]> writes: RM> Rather than this, maybe we need to add a note to all modules RM> to signify that $datetime and $dt refer to DateTime.pm RM> objects. >> That's ok, but _something_ should be said about $datetime. I >> passed time() at f

Re: SpanSet Issues and Requests

2003-10-09 Thread fglock
I've done some diagrams, in order to check if you agree with the semantics of these SpanSet functions. Some of these operations can be interpreted in more than one way. If you think something should be different, please let me know. This is the notation used: [aaa] - a closed spanset or span

RE: DT-subtraction bugs in DT::F::Excel and DT::Event::Sunrise

2003-10-09 Thread Dave Rolsky
On Thu, 9 Oct 2003, Hill, Ronald wrote: > F:\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, > 'blib\lib', 'blib\arch > )" t\00load.t t\01basic.t > t\00load.ok > t\01basicNOK 1# Failed test (t\01basic.t at line 35) > # got: '2000-06-19T07:54:00' > #

Re: [PATCH] Several fixes to DateTime::TimeZone 0.2503

2003-10-09 Thread Dave Rolsky
On Thu, 9 Oct 2003, Alexey Mahotkin wrote: > At the very least I think that the Synopsis must be updated. I agree. > I believe that arguments description could be moved after the > function description. Current situation is an RPL-ism. Huh? I think the current method descriptions are pretty s

Re: [PATCH] Several fixes to DateTime::TimeZone 0.2503

2003-10-09 Thread Dave Rolsky
On Thu, 9 Oct 2003, Alexey Mahotkin wrote: > RM> DateTime-TimeZone-0.2503/lib/DateTime/TimeZone.pm SYNOPSIS > >> + use DateTime; + my $datetime = DateTime->now(); + my $offset > >> = $tz->offset_for_datetime($datetime); > > RM> Rather than this, maybe we need to add a note to all m

Re: SpanSet Issues and Requests

2003-10-09 Thread Dave Rolsky
On Thu, 9 Oct 2003, Flavio S. Glock wrote: > DT::SpanSet misses all these methods: > next( $dt ) > previous( $dt ) > current( $dt ) > closest( $dt ) > as_list > > Is it ok to implement this in DT::SpanSet? Please do! /*=== House Absolute Consulting www.houseabsolut

Re: [PATCH] Several fixes to DateTime::TimeZone 0.2503

2003-10-09 Thread Dave Rolsky
On Thu, 9 Oct 2003, Alexey Mahotkin wrote: > I've installed DateTime::TimeZone 0.2503 from CPAN under the Perl > 5.8.1 and noticed the following glitches, which are fixed in the patch > below and described in Changes. Actually, there's intentionally no dependency on DateTime, since DateTime depen

SpanSet Issues and Requests

2003-10-09 Thread Rick Measham
G'day Flavio, I'm doing some intensive SpanSet stuff and I'm thinking you might be able to answer a couple of questions: I'm trying to get next/previous spans from a given DateTime. I'm defining next/previous as the event who started before or after $dt. Where it ends doesn't matter, even if we'r

Re: [PATCH] Several fixes to DateTime::TimeZone 0.2503

2003-10-09 Thread Alexey Mahotkin
> "RM" == Rick Measham <[EMAIL PROTECTED]> writes: >> DateTime-TimeZone-0.2503/Build.PL + 'DateTime' => 0, RM> If you do that, then you can't install it :) DateTime requires RM> that DateTime::TimeZone be installed before it will RM> install. So if you make DateTime::TimeZone

Re: SpanSet Issues and Requests

2003-10-09 Thread Flavio S. Glock
Rick Measham wrote: > > I'm trying to get next/previous spans from a given DateTime. I'm > defining next/previous as the event who started before or after $dt. > Where it ends doesn't matter, even if we're still in the middle of the > event. Here is an example (tested): --- use strict; use DateTi

Re: RFC: conditional DateTime::Set->add_duration

2003-10-09 Thread Flavio S. Glock
Flavio S. Glock wrote: > > > How about having a generic method that anticipates or > > postpones an event, if it falls in an invalid date. > > For example: > > $payday_set = DateTime::Event::Recurrence->monthly( > days => -1, > ); > [...] > > # subtract days from "payday" events, > >

RE: DT-subtraction bugs in DT::F::Excel and DT::Event::Sunrise

2003-10-09 Thread Hill, Ronald
Hi Dave, > > > On Tue, 7 Oct 2003, Hill, Ronald wrote: > > > Thanks for that!! I just started looking at the sunrise module > > to do some updates for preserving the timezone. > > > > I just installed the new release of DateTime 0.1704 > > and all tests now pass for sunrise :) > > 0.1704 is re

Re: [PATCH] Several fixes to DateTime::TimeZone 0.2503

2003-10-09 Thread Rick Measham
Alexey Mahotkin wrote: > I've installed DateTime::TimeZone 0.2503 from CPAN under the Perl > 5.8.1 and noticed the following glitches, which are fixed in the patch > below and described in Changes. They don't appear to be glitches but suggestions :) > DateTime-TimeZone-0.2503/Build.PL > +

[PATCH] Several fixes to DateTime::TimeZone 0.2503

2003-10-09 Thread Alexey Mahotkin
Hello, I've installed DateTime::TimeZone 0.2503 from CPAN under the Perl 5.8.1 and noticed the following glitches, which are fixed in the patch below and described in Changes. Please apply something along the lines of the attached patch. Thank you, diff -ruN --exclude *~ DateTime-TimeZone-0.