nrkno / core-components

Accessible and lightweight Javascript components
https://static.nrk.no/core-components/latest/
MIT License
117 stars 10 forks source link

core-datepicker: Support empty/no value #635

Closed skjalgepalg closed 3 years ago

skjalgepalg commented 3 years ago

Use type="button" in example code in docs Add handler for filling empty input when clicking todays date.

Relates to #633

skjalgepalg commented 3 years ago

This PR adds the ability to initialise a datepicker without a value.

When date has no value:

The following has been fixed:

olefjaerestad commented 3 years ago

Left a couple of comments on the code!

As an aside: The nrk.no team is currently using core-datepicker in at least a couple of apps: https://github.com/nrkno/nrkno-sendeplan and https://github.com/nrkno/nrkno-sportsopplevelse. These apps are currently not in use, as they've been season/event specific so far. When we start using them again, we'll most likely have to make tweaks to the code anyway, so small changes to the datepicker API (e.g. timestamp being replaced by date) should be no problem :)