Skip to content

Commit

Permalink
fix(VDatePicker): enforce min/max on keyboard input (#18115)
Browse files Browse the repository at this point in the history
fixes #18113
  • Loading branch information
avarixe authored Sep 7, 2023
1 parent be1d41f commit e74d19d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/vuetify/src/labs/VDatePicker/VDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,14 @@ export const VDatePicker = genericComponent<VDatePickerSlots>()({
})

function updateFromInput (input: string, index: number) {
const { isValid, date } = adapter

if (isValid(input)) {
const { isValid, date, isAfter } = adapter
const inputDate = date(input)

if (
isValid(input) &&
(!minDate.value || !isAfter(minDate.value, inputDate)) &&
(!maxDate.value || !isAfter(inputDate, maxDate.value))
) {
const newModel = model.value.slice()
newModel[index] = date(input)

Expand Down

0 comments on commit e74d19d

Please sign in to comment.