nodep-date-input-polyfill
nodep-date-input-polyfill copied to clipboard
use browser languages preferences to set date value
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:
- update Rollup & Babel versions - I couldn't run a transpile and minify without this step on any of my machines.
- 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. - add a placeholder according to the selected localeText.format e.g. dd/mm/yyyy. This more closely emulates most native date input behaviour.
- add a few more cultures (en-AU, en-NZ, en-CA, fr-CA). Default en is en-CA as that is ISO 8601