We only ever work with the current year (plus or minus one).
Which by definition includes the Feb/Mar boundry, so leap year can affect it by a day...
I don't recall what the rules are regarding the 'leap year skip',
See the google link above (searched for 'leap year calculation'); Also another reason to use Date::Calc, Date::Time, etc modules.
but I'm pretty sure it won't affect this code for a very long time.
Yeah.. i'm pretty sure that's what people said about the year 2000, which came and went, as will 2038 .. as will 2100 (which has only 28 days in Feb) .. Sure, that's a little way off, but on prinicpal you should care about the accuracy of your code, also, what about this realistic (at least plausible) scenario: Someone sees your snippet here and adapts it to their code, which isn't limited to the current year (e.g. days to/from a certain future date) and 2100 might be a valid input ..

In reply to Re^3: Calculate Age, days to next and days from last for a given birthday by davidrw
in thread Calculate Age, days to next and days from last for a given birthday by ruzam

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.