Re: Recurring set does not correctly calculate dates for second Friday of the month.

[email protected] (Marius Feraru) Thu, 2 Mar 2017 03:47:17 +0200
Newsgroups perl.datetime
Message-ID <CAP5MGKB2bnF+qxFNC91mfgRLqGW5hdzwZqOnX+HbJSqztFYLMQ@mail.gmail.com>
Hi Martin,

On Wed, Mar 1, 2017 at 1:34 AM, Andrew Martin <[email protected]> wrote:

> however 17-02-2017 is the Third Friday, the expected result is 10-02-2017
>
> I would appreciate any help, I'm baffled :-)
>
Check out D/E/R §The "week_start_day" Parameter
<https://metacpan.org/pod/DateTime::Event::Recurrence#The-%22week_start_day%22-Parameter>
 documentation:
reading its default setting explanation will quickly help you realize
what's happening. :-)

> my $set = DateTime::Event::Recurrence->monthly( weeks => 2, days =>5 );
>
By inserting ", week_start_day => 'mo'" into the line above, I get:
13-01-2017 Test event
*10*-02-2017 Test event
*10*-03-2017 Test event
14-04-2017 Test event
12-05-2017 Test event
*09*-06-2017 Test event
14-07-2017 Test event
*11*-08-2017 Test event
15-09-2017 Test event
13-10-2017 Test event
*10*-11-2017 Test event
15-12-2017 Test event

++ make sure you agree with your party what's what, as, for instance, some
will say "second Friday of September 2017 is 15th", while others say to be
"8th"… and so on. Sorry, I know it's ugly. ;-)

'HTH