parse dates correctly