t1m0n / air-datepicker

Lightweight, dependency-free JavaScript datepicker.
https://air-datepicker.com
MIT License
2.58k stars 1.36k forks source link

Time only picker does not use the current form field value #606

Closed tjveldhuizen closed 2 months ago

tjveldhuizen commented 2 months ago

When I define my picker as in this codepen, the default value in the picker is the current time, instead of the time set in the value property of the input.

Is this a bug, or is it expected and should I do something with selectDate() and an event listener to handle manual changes in the input?

t1m0n commented 2 months ago

It is not a bug, datepicker doesn't check input value. In your case you could define selected date in options like so

new AirDatepicker("#app", {
  onlyTimepicker: true,
  timepicker: true,
  selectedDates: ['2024-04-26T10:11']
});
tjveldhuizen commented 2 months ago

OK, if it's a feature I'll close the issue.