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

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

People
Owner:
Nobody in particular
Requestors:
SREZIC [...] cpan.org
Cc:
AdminCc:

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



Subject: Unexpected result for ->monthly call with weeks and days parameters
With the following script I would like to get the second Tuesday of June 2010 (similar to the example in the module's Pod): #!/usr/bin/perl -w use DateTime::Event::Recurrence; use Test::More qw(no_plan); my $set = DateTime::Event::Recurrence->monthly(weeks => 2, days => 2); is($set->next(DateTime->new(year => 2010, month => 6, day => 1))->datetime, "2010-06-08T00:00:00"); __END__ But the resulting day is the third Tuesday of June. Regards, Slaven
Subject: Re: [rt.cpan.org #54166] Unexpected result for ->monthly call with weeks and days parameters
Date: Tue, 2 Feb 2010 22:23:34 +0100
To: bug-DateTime-Event-Recurrence@rt.cpan.org
From: "Flavio S. Glock" <fglock@gmail.com>
This is explained in the POD, you can adjust "week_start_day" to the expected behaviour: --- The "week_start_day" Parameter "mo" - this is the default. The first week is one that starts in monday ... --- 2010/1/31 Slaven_Rezic via RT <bug-DateTime-Event-Recurrence@rt.cpan.org>:
Show quoted text
> Sun Jan 31 13:09:37 2010: Request 54166 was acted upon. > Transaction: Ticket created by SREZIC >       Queue: DateTime-Event-Recurrence >     Subject: Unexpected result for ->monthly call with weeks and days parameters >   Broken in: 0.16 >    Severity: (no value) >       Owner: Nobody >  Requestors: SREZIC@cpan.org >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=54166 > > > > With the following script I would like to get the second Tuesday of June > 2010 (similar to the example in the module's Pod): > > #!/usr/bin/perl -w > use DateTime::Event::Recurrence; > use Test::More qw(no_plan); > my $set = DateTime::Event::Recurrence->monthly(weeks => 2, days => 2); > is($set->next(DateTime->new(year => 2010, month => 6, day => > 1))->datetime, "2010-06-08T00:00:00"); > __END__ > > But the resulting day is the third Tuesday of June. > > Regards, >    Slaven > >
On 2010-02-02 16:24:41, fglock@gmail.com wrote:
Show quoted text
> This is explained in the POD, you can adjust "week_start_day" to the > expected behaviour: > > --- > The "week_start_day" Parameter > > "mo" - this is the default. The first week is one that starts in > monday ... > --- >
Hello Flavio, so using week_start_day => "mo" and not using week_start_day at all should give the same result? But it isn't: #!/usr/bin/perl -w use DateTime::Event::Recurrence; use Test::More qw(no_plan); my $set1 = DateTime::Event::Recurrence->monthly(weeks => 2, days => 2, week_start_day => "mo"); my $set2 = DateTime::Event::Recurrence->monthly(weeks => 2, days => 2); is($set1->next(DateTime->new(year => 2010, month => 6, day =>1))->datetime, $set2->next(DateTime->new(year => 2010, month => 6, day =>1))->datetime); __END__ not ok 1 # Failed test at /tmp/date.pl line 20. # got: '2010-06-08T00:00:00' # expected: '2010-06-15T00:00:00' 1..1 # Looks like you failed 1 test of 1. Regards, Slaven
Show quoted text
> > 2010/1/31 Slaven_Rezic via RT <bug-DateTime-Event- > Recurrence@rt.cpan.org>:
> > Sun Jan 31 13:09:37 2010: Request 54166 was acted upon. > > Transaction: Ticket created by SREZIC > > Queue: DateTime-Event-Recurrence > > Subject: Unexpected result for ->monthly call with weeks and
> days parameters
> > Broken in: 0.16 > > Severity: (no value) > > Owner: Nobody > > Requestors: SREZIC@cpan.org > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=54166 > > > > > > > With the following script I would like to get the second Tuesday of
> June
> > 2010 (similar to the example in the module's Pod): > > > > #!/usr/bin/perl -w > > use DateTime::Event::Recurrence; > > use Test::More qw(no_plan); > > my $set = DateTime::Event::Recurrence->monthly(weeks => 2, days =>
> 2);
> > is($set->next(DateTime->new(year => 2010, month => 6, day => > > 1))->datetime, "2010-06-08T00:00:00"); > > __END__ > > > > But the resulting day is the third Tuesday of June. > > > > Regards, > > Slaven > > > >
The documentation had a bug, the default week_start_day for monthly recurrences is "1mo". my $set1 = DateTime::Event::Recurrence->monthly(weeks => 2, days => 2, week_start_day => "1mo"); my $set2 = DateTime::Event::Recurrence->monthly(weeks => 2, days => 2); is($set1->next(DateTime->new(year => 2010, month => 6, day =>1))->datetime, $set2->next(DateTime->new(year => 2010, month => 6, day =>1))->datetime); Fixed in 0.19 Sorry for the long delay in fixing this. Em Seg Ago 16 15:58:44 2010, SREZIC escreveu:
Show quoted text
> On 2010-02-02 16:24:41, fglock@gmail.com wrote:
> > This is explained in the POD, you can adjust "week_start_day" to the > > expected behaviour: > > > > --- > > The "week_start_day" Parameter > > > > "mo" - this is the default. The first week is one that starts in > > monday ... > > --- > >
> > Hello Flavio, > > so using week_start_day => "mo" and not using week_start_day at all > should give the same result? But it isn't: > > #!/usr/bin/perl -w > use DateTime::Event::Recurrence; > use Test::More qw(no_plan); > my $set1 = DateTime::Event::Recurrence->monthly(weeks => 2, days => 2, > week_start_day => "mo"); > my $set2 = DateTime::Event::Recurrence->monthly(weeks => 2, days => 2); > is($set1->next(DateTime->new(year => 2010, month => 6, day =>1))->datetime, > $set2->next(DateTime->new(year => 2010, month => 6, day =>1))->datetime); > __END__ > not ok 1 > # Failed test at /tmp/date.pl line 20. > # got: '2010-06-08T00:00:00' > # expected: '2010-06-15T00:00:00' > 1..1 > # Looks like you failed 1 test of 1. > > > > Regards, > Slaven > >
> > > > 2010/1/31 Slaven_Rezic via RT <bug-DateTime-Event- > > Recurrence@rt.cpan.org>:
> > > Sun Jan 31 13:09:37 2010: Request 54166 was acted upon. > > > Transaction: Ticket created by SREZIC > > > Queue: DateTime-Event-Recurrence > > > Subject: Unexpected result for ->monthly call with weeks and
> > days parameters
> > > Broken in: 0.16 > > > Severity: (no value) > > > Owner: Nobody > > > Requestors: SREZIC@cpan.org > > > Status: new > > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=54166 > > > > > > > > > > With the following script I would like to get the second Tuesday of
> > June
> > > 2010 (similar to the example in the module's Pod): > > > > > > #!/usr/bin/perl -w > > > use DateTime::Event::Recurrence; > > > use Test::More qw(no_plan); > > > my $set = DateTime::Event::Recurrence->monthly(weeks => 2, days =>
> > 2);
> > > is($set->next(DateTime->new(year => 2010, month => 6, day => > > > 1))->datetime, "2010-06-08T00:00:00"); > > > __END__ > > > > > > But the resulting day is the third Tuesday of June. > > > > > > Regards, > > > Slaven > > > > > >
> >


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.