I'm using Date::Manip to determine the next business day, taking holidays into account. My problem is business days are M-F, but observed holidays are the following day (Monday) if the holiday is a Sunday, however, if holidays land on a Saturday, they are still observed on that day.

Following the documentation, I've tried in my holiday config file 1*1:0:1:0:0:0*NWD = New Years Day, but it lists BOTH Saturday and Sunday New Year days on the following Monday. I've also tried 1*1:0:2:0:0:0*WD2 = New Years Day, but it always picks the Monday of the week of Jan 2.

Is there a way I can dynamically generate the correct observed holidays? I'm currently hard-coding these Sunday holidays every few years which is a perfect environment for screwing it up.

CLARIFICATION: Holidays are to be observed on their usual date unless it falls on a Sunday. In this case, the holiday is observed the following Monday. In addition, Saturdays are never "business" days.

EDIT: Monday Jan 2 = New Years Day (observed) is essentially what I need, but that syntax doesn't work.


In reply to Date::Manip Sunday Holidays by ksublondie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.