Skip to content

Releases: mcshaz/esm-date-input-polyfill

Typescript

24 Apr 19:26
Compare
Choose a tag to compare
  • Source code moved to Typescript
  • Typescript definition files are included in the distributable for consuming code using Typescript
  • If a date has an incorrect month entered via keyboard (e.g. 13) or a date which does not exist on that month (e.g. 31st Feb) the customValidation message places asterisk around the incorrect date component - e.g. **DD**/mm/yyyy or dd/**MM**/yyyy
  • Build/transpiling process now uses minified ECMAScript from the distributable when bundling and minifying the examples (as opposed to referencing the source code)
  • The polyfill-if-required function resolves with an array of polyfilled input instances if the polyfill is required (null otherwise)

Min Max Support

16 Apr 04:33
Compare
Choose a tag to compare

Changes:

  • Scores more cultures and languages. Some code changes to keep file size small

  • lazy loading so only a tiny code base is loaded if date input is natively supported

  • uses browser culture preferences when selecting date culture - as an example, if the browser culture is set as en-uk, the date will be displayed in DMY, even if the page has a lang="en" attribute.

  • a textValue property is added which is the native value property of the text input

  • valueAsDate handles being assigned null (perfectly valid) or invalid dates (.getTime() is NaN)

  • typing or deleting a text date directly in the input element adjusts the datepicker and the value/valueAsDate properties accordingly (although at present only dates between 1000 & 2999 A.D.)

  • tabbing to the next field closes the datepicker

  • bug fixed with the up/down arrows whereby they would move the date 1 day only within the current month/year and then cycle back to the same month

  • updated the devDependencies to latest versions, including moving from rollup-plugin-babel-minify (deprecated/no longer supported) to rollup-plugin-terser.

  • moved the support matrix to IE11 only - this is based on the fact that I am not sure the extra code base for earlier versions is worth it given current usage stats, but you could always run the build yourself with the appropriate rollup options babel.preset.target. Similarly it is not tested in Safari.

  • support of min/max attributes to what is selectable in the date picker. Invalid date style and cursor adjusted for days outside these limits.

  • set customValidity if that exists as a property and the user has typed a date which is outside min or max.
    pattern attribute in case date is entered in the wrong format.
    language handling which closer replicates native browser behavior.