react-day-picker is not working in Safari
Hello, I got an error on Safari browser. TypeError: undefined is not an object (evaluating 'firstWeek.length'), DayPickerInput works fine in other browsers. I used "react-day-picker": "^7.2.2"
Thanks
I have the same issue on Safari and Chrome mobile (iPhone). Is there any solution to this?
Hello any updated on this? thank you
Hello, I figured it out.
I just removed the month key under the dayPickerProps prop, then it works fine.
Previous code
<DayPickerInput
className="materialInput"
value={this.state.pickup_at}
onDayChange={this.handleDayChangePickUpAt}
placeholder={APP.DATE_FORMAT}
format={APP.DATE_FORMAT}
initialMonth={new Date(minPickupMomentMonth)}
formatDate={this.formatDate}
inputProps={{
readOnly: true,
disabled: this.state.pay_at === '',
}}
dayPickerProps={{
fromMonth: new Date(minPickupMomentMonth),
month: new Date(maxPickupMomentMonth),
toMonth: new Date(maxPickupMomentMonth),
modifiers: {
disabled: [
{
daysOfWeek: [0, 6],
},
{
before: new Date(minPickupDate),
},
{
after: new Date(maxPickupDate),
},
],
},
}}
/>
Current code:
<DayPickerInput
className="materialInput"
value={this.state.pickup_at}
onDayChange={this.handleDayChangePickUpAt}
placeholder={APP.DATE_FORMAT}
format={APP.DATE_FORMAT}
initialMonth={new Date(minPickupMomentMonth)}
formatDate={this.formatDate}
inputProps={{
readOnly: true,
disabled: this.state.pay_at === '',
}}
dayPickerProps={{
fromMonth: new Date(minPickupMomentMonth),
toMonth: new Date(maxPickupMomentMonth),
modifiers: {
disabled: [
{
daysOfWeek: [0, 6],
},
{
before: new Date(minPickupDate),
},
{
after: new Date(maxPickupDate),
},
],
},
}}
/>
Thank you,
I have the same issue on Safari and Chrome mobile (iPhone). Is there any solution to this?
check all the props. In my case, I mixed the props DayPicker to DayPickerInput.
@junmich
Please I need your input on this.
I am having the same issue. In firefox and safari, my DayPicker is not working.
<DayPicker
className="FlightDateRange"
value={returnDate}
format="LL"
formatDate={formatDate}
parseDate={parseDate}
numberOfMonths={2}
fromMonth={new Date(moment(departureDate).format("YYYY, MM"))}
initialMonth={
departureDate
? new Date(moment(departureDate).format("YYYY, MM"))
: undefined
}
selectedDays={selectedDays}
showOutsideDays={false}
disabledDays={[{
before: departureDate
}]}
modifiers={modifiers}
onDayClick={onReturnDayClicked}
/>
Please what do you think is the fix?
I have resolved it. The issue was new Date(moment(departureDate).format("YYYY, MM")).
I changed it to new Date(moment(departureDate).format("YYYY-MM")) and it worked