Add len0 check to first_day and last_day