added checking for the dates (including if it is a leap year or not)