Fixed date parse problem.

(also added a simple test)