Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix DateTimeInput is not working correctly. #7661 #7662

Conversation

bingluen
Copy link
Contributor

@bingluen bingluen commented May 9, 2022

Return empty string if parseDateTime function receive empty string as value instead Invalid Date(Date object)

Reference #7661

Return empty string if `parseDateTime` function receive empty string as value instead `Invalid Date`(`Date` object)
@@ -15,7 +15,7 @@ import { InputHelperText } from './InputHelperText';
* @param {string} value Date string, formatted as yyyy-MM-ddThh:mm
* @return {Date}
*/
const parseDateTime = (value: string) => new Date(value);
const parseDateTime = (value: string) => value ? new Date(value) : value;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or return undefined is closer to the semantics clear/reset

@djhi
Copy link
Contributor

djhi commented May 23, 2022

Thanks !

@djhi djhi closed this May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants