Fixed "Invalid date" error on valid dates