This queue is for tickets about the DateTime-Event-Recurrence CPAN distribution.

Report information
The Basics
Id:
79375
Status:
resolved
Worked:
1 hour (60 minutes)
Users:
FGLOCK: 1 hour (60 minutes)
Priority:
Low/Low

People
Owner:
FGLOCK [...] cpan.org
Requestors:
IDN [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Important
Broken in:
0.16
Fixed in:
(no value)



Subject: Constructor ignores start and interval
Hi Peeps, This module seems to be ignoring start and interval. See the test below: <snip> #!/usr/bin/perl use strict; use warnings; use DateTime; use DateTime::Event::Recurrence; my $dt_start = DateTime->now(); print("Datetime start is " . $dt_start . "\n"); my $set = DateTime::Event::Recurrence->daily( interval => 11, hours => 10, minutes => 30, start => $dt_start, ); print("Set start: " . $set->min->mdy . "\n"); print("Set end: " . $set->max->mdy . "\n"); <.snip> Outputs: Datetime start is 2012-09-03T14:05:50 Spanset start: -9223372036854775808--9223372036854775808--9223372036854775808 Spanset end: -01--01--0001 For some reason the args seem to be ignored and the returned set is unbound giving a min and max of infinity. I've had a very quick look at the source but I can't see an obvious place to start. Thanks, Ian.
Subject: Re: [rt.cpan.org #79375] Constructor ignores start and interval
Date: Mon, 3 Sep 2012 17:23:24 +0200
To: bug-DateTime-Event-Recurrence@rt.cpan.org
From: "Flavio S. Glock" <fglock@gmail.com>
The "start" parameter specifies an anchor date, and the "interval" counts forward and backwards in time. "start" doesn't bound the set. You can get a bounded set by intersecting the recurrence with a DateTime::Span. Re-reading the docs, I can see this could be better documented, sorry. 2012/9/3 Ian Norton via RT <bug-DateTime-Event-Recurrence@rt.cpan.org>:
Show quoted text
> Mon Sep 03 10:14:17 2012: Request 79375 was acted upon. > Transaction: Ticket created by IDN > Queue: DateTime-Event-Recurrence > Subject: Constructor ignores start and interval > Broken in: 0.16 > Severity: Important > Owner: Nobody > Requestors: IDN@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79375 > > > > Hi Peeps, > > This module seems to be ignoring start and interval. > > See the test below: > > <snip> > #!/usr/bin/perl > > use strict; > use warnings; > > use DateTime; > use DateTime::Event::Recurrence; > > my $dt_start = DateTime->now(); > > print("Datetime start is " . $dt_start . "\n"); > > my $set = DateTime::Event::Recurrence->daily( > interval => 11, > hours => 10, > minutes => 30, > start => $dt_start, > ); > > print("Set start: " . $set->min->mdy . "\n"); > print("Set end: " . $set->max->mdy . "\n"); > <.snip> > > Outputs: > > Datetime start is 2012-09-03T14:05:50 > Spanset start: > -9223372036854775808--9223372036854775808--9223372036854775808 > Spanset end: -01--01--0001 > > For some reason the args seem to be ignored and the returned set is > unbound giving a min and max of infinity. > > I've had a very quick look at the source but I can't see an obvious > place to start. > > Thanks, Ian.
The "start" parameter only provides an anchor for calculation of where the "interval" starts. This is documented (paste below) but the language could be clearer. In order to limit the set, an intersection with a DateTime::Span can be used. Alternately, the as_list() method accepts DateTime::Span parameters as well: my @dt = $set->as_list( start => $dt1, end => $dt2 ); Note: sorry, I only saw this ticket today. """ =head2 The "interval" and "start" Parameters The "interval" parameter represents how often the recurrence rule repeats. The optional "start" parameter specifies where to start counting: my $dt_start = DateTime->new( year => 2003, month => 6, day => 15 ); my $set = DateTime::Event::Recurrence->daily ( interval => 11, hours => 10, minutes => 30, start => $dt_start, ); This specifies a recurrence that happens at 10:30 on the day specified by C<< start => $dt >>, and then every 11 days I<before and after> C<$dt>. So we get a set like this: ... 2003-06-04T10:30:00, 2003-06-15T10:30:00, 2003-06-26T10:30:00, ... """ Em Seg Set 03 11:23:38 2012, fglock@gmail.com escreveu:
Show quoted text
> The "start" parameter specifies an anchor date, and the "interval" > counts forward and backwards in time. > > "start" doesn't bound the set. > > You can get a bounded set by intersecting the recurrence with a > DateTime::Span. > > Re-reading the docs, I can see this could be better documented, sorry. > > 2012/9/3 Ian Norton via RT <bug-DateTime-Event- > Recurrence@rt.cpan.org>:
> > Mon Sep 03 10:14:17 2012: Request 79375 was acted upon. > > Transaction: Ticket created by IDN > > Queue: DateTime-Event-Recurrence > > Subject: Constructor ignores start and interval > > Broken in: 0.16 > > Severity: Important > > Owner: Nobody > > Requestors: IDN@cpan.org > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79375 > > > > > > > Hi Peeps, > > > > This module seems to be ignoring start and interval. > > > > See the test below: > > > > <snip> > > #!/usr/bin/perl > > > > use strict; > > use warnings; > > > > use DateTime; > > use DateTime::Event::Recurrence; > > > > my $dt_start = DateTime->now(); > > > > print("Datetime start is " . $dt_start . "\n"); > > > > my $set = DateTime::Event::Recurrence->daily( > > interval => 11, > > hours => 10, > > minutes => 30, > > start => $dt_start, > > ); > > > > print("Set start: " . $set->min->mdy . "\n"); > > print("Set end: " . $set->max->mdy . "\n"); > > <.snip> > > > > Outputs: > > > > Datetime start is 2012-09-03T14:05:50 > > Spanset start: > > -9223372036854775808--9223372036854775808--9223372036854775808 > > Spanset end: -01--01--0001 > > > > For some reason the args seem to be ignored and the returned set is > > unbound giving a min and max of infinity. > > > > I've had a very quick look at the source but I can't see an obvious > > place to start. > > > > Thanks, Ian.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.