Closed djzort closed 7 years ago
To be honest, I'm not sure what your logic was (NWD,IW1), but what you've said was take Jan 29, find the next business day, and then discard it if it's not Monday. In other words, this recurrence will only return dates for years where Jan 29 falls on Saturday, Sunday, or Monday, and ignore all other years, and it will only look for a Monday on or after Jan 29.
I would try the following modifiers (instead of NWD,IW1):
BD3,NT1
The nearest Monday to Jan 29 will be one of the days between 3 days before the 29th and 3 days after. So, step back 3 days (to Jan 26) and look for the next Monday including today (NT1).
Alternately, you can skip the BD3 part by using the recurrence:
1*1:0:26:0:0:0*NT1
Even though this might be a bit faster, I would still stick with the one based on Jan 29 as it makes it clear that Jan 29 is the base date you're looking for:
1*1:0:29:0:0:0*BD3,NT1
My approach was: try the next business day, is it tuesday?, go to previous bd, is it tuesday? repeat - so searching back and forth to find the closest. however jumping back and moving forward makes more sense.
This has worked perfectly. Thank you kindly for your insight.
I dont know if this is the right place to ask, but here goes.
I am trying to implement the Data::Manip::Recur definition for New Zealands 'Auckland Anniversary Day' (and other anniversary days, which follow a similar selection criteria).
The criteria is "Monday nearest to 29th", either before or after and can be in Feb. Lots of details at http://www.officeholidays.com/countries/new_zealand/auckland_provincial.php
This line seems to work for some years but not all:
1*1:0:29:0:0:0*NWD,IW1 = Auckland Anniversary Day
It successfully predicts 2017-01-30 & 2018-01-29, but not others.
Im not surpised it doesnt select dates prior as it is Next Working Day, but it doesnt select 2016-02-01 which is the next working day and is a monday. I suspect that because its in Feb its being ignored?
I have attempted to add more selectors on the end to go backwards but havent succeeded in matching any dates other than 2017 and 2018
Please help?