react-day-picker icon indicating copy to clipboard operation
react-day-picker copied to clipboard

react-day-picker is not working in Safari

Open junmich opened this issue 8 years ago • 6 comments

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

junmich avatar Sep 26 '18 07:09 junmich

I have the same issue on Safari and Chrome mobile (iPhone). Is there any solution to this?

teodortoni avatar Sep 28 '18 15:09 teodortoni

Hello any updated on this? thank you

junmich avatar Oct 01 '18 06:10 junmich

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,

junmich avatar Oct 01 '18 07:10 junmich

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 avatar Oct 01 '18 07:10 junmich

@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?

smithaitufe avatar Jun 17 '19 23:06 smithaitufe

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

smithaitufe avatar Jun 18 '19 00:06 smithaitufe