user29826116
user29826116

Reputation: 1

Material UI Date Picker Typescript, Property 'target' does not exist on type 'Dayjs'

I am implementing a material UI datepicker into a TypeScript application. The code functions properly however I am getting a warning in VS code regarding the e.target.value.toISUString() the error says "Property 'target' does not exist on type 'Dayjs'"

I am not exactly sure why I get this message as I am only looking for 'target' on the onChange event and it does exist.

            <MuiDatePicker
              id="reminderDate"
              name="reminderDate"
              label="Reminder Date"
              fullWidth={true}
              value={reminderDate}
              onChange={(e) => setReminderDate(e.target.value.toISOString())}
              views={["month", "year", "day"]}
              disablePast={true}
              // onClose={onClose}
              sx={{ paddingBottom: "12px" }}
            />

I have tried tweaking the naming conventions (using event instead of e) but that didn't fix anything.

Upvotes: 0

Views: 21

Answers (0)

Related Questions