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:
Eric Jensen
Date:
March 2, 2017 02:10
Subject:
Re: Recurring set does not correctly calculate dates for secondFriday of the month.
Message ID:
150BD217-895C-48AD-AF64-F617863C40F6@swarthmore.edu
Hi all,

> On Mar 1, 2017, at 8:47 PM, Marius Feraru <altblue@n0i.net> wrote:
> 
> ++ 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. ;-)
> 

Marius, I didn’t understand your comment here.  Isn’t this a question with only one answer, not a matter of having to agree beforehand?  i.e. isn’t the second Friday of September 2017 *really* the 8th?  

Also, looking at the week_start_day parameter, wouldn’t ‘1fr’ work better?  (Then we start counting on the first Friday, so we really get the second Friday correctly.)  For me, that gives Sept. 8 as the second Friday of Sept. 2017, anyway.  :-)   Likewise for Dec. 8. 

Also, I’ll note that the docs for DateTime::Event::Recurrence give an example that’s exactly like the original poster’s code:
# second tuesday of every month
my $set = DateTime::Event::Recurrence->monthly( weeks => 2, days => 2 );
so maybe that should be clarified.  Also, since the docs say “The week_start_day parameter is intended for internal use…” that initially implied to me that it shouldn’t be set by a caller - so I wonder if there’s another way to clarify that in the docs. 

Eric


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