Rome datetimepicker(JS)

461 Views Asked by At

I want to use rome datetimepicker. If the user selects date do not hide the datetime picker. Hide it only after time selection. I am using this library https://bevacqua.github.io/rome/

1

There are 1 best solutions below

1
a--m On

Setting the autoClose to time hides the picker only after the user selects a time. Otherwise, it will keep the picker visible:

The documentation reference:

autoClose: When set to true, the calendar is auto-closed when picking a day _(or a time if time: true and date: false). A value of 'time' will only auto-close the calendar when a time is picked.

And here you can see an example using those same configuration:

const input = document.querySelector('#input')
rome(input, {
  autoClose: 'time'
})
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/rome.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/rome.min.js"></script>

<input id="input" autocomplete="off" />