equinor / design-system

The Equinor design system
MIT License
121 stars 64 forks source link

DatePicker Calendar is displaying wrong #3668

Closed jarlef closed 3 weeks ago

jarlef commented 3 weeks ago

Describe the bug

The calendar in DatePicker displays wrong for browsers using en-US culture

Culture en-uS

wrong

The dates displays on the wrong day of week.

Culture no-NB

correct

The dates displays on the correct day of week

In addition i have explicit configured the culture to en-GB on the date input to display the date format as dd/mm/yyyy and i would expect the calendar using the same culture.

NB We use en-GB as culture to display the date format as dd/mm/yyyy and not dd/mm/åååå to keep the date input in english


 <DatePicker
        readOnly={readOnly}
        value={dueDate}
        onChange={date => onDateChanged(date ?? undefined)}
        onBlur={() => handleSave()}
        disabled={loading}
        locale="en-GB"
      />```

**Steps to reproduce the bug**

Change the culture in chrome to en-US and open the data picker calendar

**Expected behavior**

Use the same culture as the Date input field
jarlef commented 3 weeks ago

We also wrap the entire app with <I18nProvider locale="en-GB"> just to ensure the culture is correct

jarlef commented 3 weeks ago

Turns out we have a duplicate package of react-aria which messes up the locale. Removing our local installed package fixed the locale