How to disable particular time slots in timepicker material UI

Viewed 39

So i have a array of timeslots from which i want user to pick a time lets say

var arr = ["11:00:00","11:10:00","13:00:00"]

how can i disable other time slots from timepicker and only enable this time slots

My TimePicker

<TimePicker
      label="Time"
      value={value}
      onChange={handleChange}
      renderInput={(params) => <TextField {...params} />}
    />

Array of TimeSlots i want user to pick from

var timeSlots = [ "10:00", "10:30", "11:00", "11:30", "12:00", "12:30", "13:00", "13:30", "14:00", "14:30", … ]

Actaully im getting this timeslots array from api

1 Answers

Hey Ronak you can use Filter() function of ES6 to get limited or particular timeslot. Try to use filter while fetching the timeSlot from API. If you still face any error just lemme know.

Related