nodep-date-input-polyfill icon indicating copy to clipboard operation
nodep-date-input-polyfill copied to clipboard

use browser languages preferences to set date value

Open mcshaz opened this issue 5 years ago • 0 comments

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

mcshaz avatar Dec 19 '19 09:12 mcshaz