dmtrKovalenko / date-io

Abstraction over common javascript date management libraries
MIT License
726 stars 90 forks source link

@date-io/dayjs utils.getDayText is not a function #593

Closed LukasDeco closed 3 years ago

LukasDeco commented 3 years ago

I am using the date picker from "@material-ui/pickers". Passing in DayjsUtils. I am getting a utils.getDayText is not a function error that is crashing the app. What's the deal?

Thanks!

import DayjsUtils from "@date-io/dayjs";
import { DatePicker, MuiPickersUtilsProvider } from "@material-ui/pickers";
import { MaterialUiPickersDate } from "@material-ui/pickers/typings/date";

...

<MuiPickersUtilsProvider utils={DayjsUtils}>
                  <DatePicker
                    className={classes.datePicker}
                    disablePast={true}
                    value={reminderDate}
                    onChange={handleReminderDateChange}
                  />
                </MuiPickersUtilsProvider>

Here is full error with stacktrace:

Uncaught TypeError: utils.getDayText is not a function
    at Calendar.tsx:268
    at Array.map (<anonymous>)
    at Calendar._this.renderDays (Calendar.tsx:263)
    at Calendar.tsx:250
    at Array.map (<anonymous>)
    at Calendar._this.renderWeeks (Calendar.tsx:249)
    at Calendar.render (Calendar.tsx:334)
    at finishClassComponent (react-dom.development.js:17081)
    at updateClassComponent (react-dom.development.js:17033)
    at beginWork (react-dom.development.js:18544)
    at HTMLUnknownElement.callCallback (react-dom.development.js:112)
    at HTMLUnknownElement.__trace__ (inline-script-content.js:146)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:161)
    at invokeGuardedCallback (react-dom.development.js:214)
    at beginWork$1 (react-dom.development.js:23125)
    at performUnitOfWork (react-dom.development.js:22081)
    at workLoopSync (react-dom.development.js:22059)
    at performSyncWorkOnRoot (react-dom.development.js:21680)
    at react-dom.development.js:11016
    at unstable_runWithPriority (scheduler.development.js:577)
    at runWithPriority$1 (react-dom.development.js:10962)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11011)
    at flushSyncCallbackQueue (react-dom.development.js:10998)
    at discreteUpdates$1 (react-dom.development.js:21819)
    at discreteUpdates (react-dom.development.js:731)
    at dispatchDiscreteEvent (react-dom.development.js:4097)
    at HTMLDocument.__trace__ (inline-script-content.js:146)
brianrodrigueztp commented 3 years ago

You must use v1 for @date-io/dayjs as per the docs