Skip to content

Commit

Permalink
Do not allow input any chars when value is nul (mui#1265)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Aug 17, 2019
1 parent 61cab07 commit 142cb5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/pages/demo/timepicker/KeyboardTimePicker.example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function KeyboardTimePickerExample() {
placeholder="08:00 AM"
mask="__:__ _M"
value={selectedDate}
onChange={handleDateChange}
onChange={date => handleDateChange(date)}
/>
);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/src/_helpers/text-field-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ export function makeMaskFromFormat(format: string, numberMaskChar: string) {
export const maskedDateFormatter = (mask: string, numberMaskChar: string, refuse: RegExp) => (
value: string
) => {
if (value === '') {
return value;
}

let result = '';
const parsed = value.replace(refuse, '');

if (parsed === '') {
return parsed;
}

let i = 0;
let n = 0;
while (i < mask.length) {
Expand Down

0 comments on commit 142cb5f

Please sign in to comment.