Skip to content

use browser languages preferences to set date value #70

@mcshaz

Description

@mcshaz

Thank you for the library - great effort & very much appreciated.

I think the few browsers left which do not have a native date type input will be soon gone, so I am not sure how much longer this library will be maintained for. Nevertheless, I have made some changes in a fork which I am happy to put a pull request for if wanted. Heavily tested in IE 11 but NOT old versions of Safari.

The changes are:

  1. update Rollup & Babel versions - I couldn't run a transpile and minify without this step on any of my machines.
  2. use the browser prefered language and only use the lang attribute if the browser languages are not found (using let preferredLocales = window.navigator.languages || [ window.navigator.userLanguage || window.navigator.language ];). This more closely emulates most native date input behaviour.
  3. add a placeholder according to the selected localeText.format e.g. dd/mm/yyyy. This more closely emulates most native date input behaviour.
  4. add a few more cultures (en-AU, en-NZ, en-CA, fr-CA). Default en is en-CA as that is ISO 8601

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions