Fix a bug when calculating leap year in timepicker.