Fix incorrect selection of dates for calendar