Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/app/material-timepicker/services/time-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export class TimeAdapter {
}
const {format} = opts;
const parsedTime = TimeAdapter.parseTime(time, opts).setLocale(TimeAdapter.DEFAULT_LOCALE);

if (!parsedTime.isValid) {
return null;
Copy link
Author

Choose a reason for hiding this comment

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

I'd like to point out that I prefer null here over 'Invalid Time', otherwise the invalid value entered by the user will be replaced with 'Invalid Time' in the input field, which is not nice as the user won't be able to correct his/her mistake. I'd leave it to the developer to put form validation on the input field.

}
if (format !== 24) {
return parsedTime.toLocaleString({
...DateTime.TIME_SIMPLE,
Expand Down