Fixing datetime picker logic