input type="date" fires before the user makes a selection. A mostly-minimal example is this:
It’s in a fiddle here: https://jsfiddle.net/1jnqf5aL/1/
In this example run on Safari, when the form is initially loaded and the date item is touched/tapped, the change event fires immediately and the value of the input item is the current date. My application detects the change event and emits a “Departure date must be in the future” error message before the user has had an opportunity to select a date.
With other browsers, e.g. Chrome, Edge, Firefox, the change event does not fire until the user has selected a date in the calendar form.
I can make Safari behave, sort-of, by providing an initial
value= attribute on the input element where the value is the current date in ISO 8601 format. The trouble with that is, the current date is not a valid date in this application, so I don’t want to show it to the user of the application. Browser sniffing will fail if/when Safari is changed to behave similarly to other browsers.
My question: How can I accommodate, or “program around” this behavior of Safari without browser sniffing? Or, have I missed something obvious and fundamental?