I've run into this a couple of different times in my work and all I can tell is that both are correct...depending on the business needs at hand.

For example, a billing statement often, by law, needs to provide a set number of days. When implementing that sort of system, you find out what the client's accountants use when balancing the books and go from there.

On the other hand, a calender is generally looking for something to the effect of Dec 30 to Jan 30.

To handle the "Feb 30" problem, I usually decrement the previous result by one day until I have a valid date. The next search then becomes Mar 28 (or 29, depending on the year).

If you're not completely comfortable forcing either approach, then use gaspodethewonderdog's idea: implement both and then let the end user/developer choose which they prefer via a property or configuration setting.

--f

In reply to Re: Year /^\d+$/ bug! by footpad
in thread Year /^\d+$/ bug! by $code or die

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.