Fix exception while typing in date using keyboard input

Related to issue #24