vaadin/vaadin-date-picker

Date Picker not respecting browser locale

RobMaskell opened this issue · 1 comments

Description

The date picker is working fine as far as picking dates and having those dates correctly serialised and appearing correctly in the database but the date that is shown to the user is in US format and not UK format even though the locale is en-GB.

I was under the impression that the component respected the locale, apologies if that isn't the case.

Expected outcome

Date shown in text box should be dd/mm/yyy

Actual outcome

date showing as mm/dd/yyyy

Steps to reproduce

  1. Make sure browser locale / accept-language header is en-GB
  2. Put a vaadin-date-picker element in the page.
  3. Open the page in a web browser.
  4. look at date on page or select one if empty

Browsers Affected

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE 11
  • iOS Safari
  • Android Chrome

More details

Linux / Chromium or Firefox / latest version of vaadin-date-picker (4.0.0)

Polymer PWA project, the the following HTML

          <vaadin-date-picker
            name="openDate"
            label="Open Date"
            placeholder="Pick a date for your zone to open for business"
            .value="${zone.openDate}" required >
          </vaadin-date-picker>

Hi, the default locale is always US. To change this, you can modify the properties of the i18n object. Here's an example that uses a library called Sugar for localizing but the same pattern can be used with other libraries such as Moment