develooper Front page | perl.datetime | Postings from March 2017

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

Thread Previous | Thread Next
From:
Marius Feraru
Date:
March 2, 2017 01:47
Subject:
Re: Recurring set does not correctly calculate dates for secondFriday of the month.
Message ID:
CAP5MGKB2bnF+qxFNC91mfgRLqGW5hdzwZqOnX+HbJSqztFYLMQ@mail.gmail.com
Hi Martin,

On Wed, Mar 1, 2017 at 1:34 AM, Andrew Martin <andrew@marnick.com> 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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About