Problems generating a set using the DataTime::Easter module

2003-08-15 Thread Hill, Ronald
Hi All,

I am having problems generating a set using the DateTime:;Easter module.
Here is the code.

#!/usr/bin/perl
use strict;
use warnings;
use DateTime;
use DateTime::Set;
use DateTime::Event::Easter;

my $easter_sunday = DateTime::Event::Easter-new();


my $dt1 = DateTime-new( year   = 2000,
 month  = 1,
 day= 1,
  );

my $dt2 = DateTime-new( year   = 2050,
 month  = 12,
 day= 1,
  );
my $set1 = $easter_sunday-as_set(from=$dt1, to=$dt2);

error is:
Can't locate object method new via package DateTime::Set 
(perhaps you forgot to load DateTime::Set?) at 
F:/perl/site/lib/DateTime/Event/Easter.pm line 184.

It seems that there is no new method in the DateTime::Set
module.

Please advise.

Thanks

Ron Hill


Bug with $dt-substract ??

2003-08-15 Thread Thomas Klausner
Hi!

I'm getting strange results when subtracting dates from one another:

I make a new $dt object, setting the date to e.g. 2003-05-31. If I subtract
one month, I do not get 2003-04-30, but 2005-05-01, which seems wrong to me.

This problem only occurs in months with 31 days, exept August, which works.

March gives even stranger results.

I attached a small script illustrating the problem.

It's either a bug (if it is I could try to track it down more closely), or
I'm doing something dumb (in which case I'd appreciate some advice...)

I'm using DateTime-0.1601 and perl.5.8.0

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}


bug.pl
Description: Perl program


Re: Bug with $dt-substract ??

2003-08-15 Thread Dave Rolsky
On Fri, 15 Aug 2003, Thomas Klausner wrote:

 I'm getting strange results when subtracting dates from one another:

 I make a new $dt object, setting the date to e.g. 2003-05-31. If I subtract
 one month, I do not get 2003-04-30, but 2005-05-01, which seems wrong to me.

 This problem only occurs in months with 31 days, exept August, which works.

 March gives even stranger results.

 I attached a small script illustrating the problem.

 It's either a bug (if it is I could try to track it down more closely), or
 I'm doing something dumb (in which case I'd appreciate some advice...)

 I'm using DateTime-0.1601 and perl.5.8.0

The results are actually consistent with the internal logic, but
definitely surprising for end users.

If you add end_of_month = 'preserve' it does what you are wanting.

I wonder if we shouldn't make preserve the default EOM mode when the
duration is negative?


-dave

/*===
House Absolute Consulting
www.houseabsolute.com
===*/


Re: Bug with $dt-substract ??

2003-08-15 Thread Thomas Klausner
Hi!

On Fri, Aug 15, 2003 at 12:53:56PM -0500, Dave Rolsky wrote:

 The results are actually consistent with the internal logic, but
 definitely surprising for end users.

Surprising, indeed.

 If you add end_of_month = 'preserve' it does what you are wanting.

Ah, after reading the docs more closely (thanks to the pointer to
'preserve'), i figured out my 'mistake'.

 I wonder if we shouldn't make preserve the default EOM mode when the
 duration is negative?

Either this, or maybe add a hint to the 'end_of_month' parameter of new to
the docs of add/subtract (expecially in DateTime itself)

Thanks for the prompt awnser (and the very nice module!)

-- 
#!/usr/bin/perl   http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$-gprint$_.$/}