title: What are some examples of leap year bugs?
body: <p>A leap year bug is a code defect that creates a problematic, unintended outcome when executed within the context of a <a href="https://en.wikipedia.org/wiki/Leap_year" rel="noreferrer">leap year</a>, typically within the proleptic Gregorian calendar system.</p>
  
  <p>The last leap year was 2016.  The next leap years are 2020 and 2024.</p>
  
  <p>There are two attributes that are unique to leap years:</p>
  
  <ul>
  <li>Leap years have a February 29th, while common years do not.</li>
  <li>Leap years have 366 days in total, while common years have only 365.</li>
  </ul>
  
  <p>This post is intended to help others understand the nature of leap year bugs, what they look like in various languages, and how to correct them.</p>
  
  <p>Leap year bugs typically fall into two impact categories:</p>
  
  <ul>
  <li><strong>Category 1</strong>: Those that lead to error conditions, such as exceptions, error return codes, uninitialized variables, or endless loops</li>
  <li><strong>Category 2</strong>: Those that lead to incorrect data, such as off-by-one problems in range queries or aggregation</li>
  </ul>
  
  <p>With each answer, please indicate the programming language and/or platform, as well as the impact category as defined above.  (Follow the template used by existing answers please.)</p>
  
  <p>Please create one separate answer per language and type of defect, and vote for your favorite, especially those you have personally encountered (leaving comments with anecdotes where possible).</p>
  
  <p><em>I will seed a few answers to get started, and update with additional examples over time.</em></p>