Fix bug when selecting time.