bevacqua / rome

:calendar: Customizable date (and time) picker. Opt-in UI, no jQuery!
https://bevacqua.github.io/rome
MIT License
2.91k stars 223 forks source link

Custom Time Options #224

Open trymeouteh opened 5 months ago

trymeouteh commented 5 months ago

Please add the ability to choose custom time options as you can for dates.

Using this feature I would image would look something like this, similar to customising the date options

    //10:37 not selectable
    rome(document.querySelectorAll('input')[0], {
        timeValidator: rome.val.except('10:37')
    });

    //10:37, 12:32 and 14:04 not selectable
    rome(document.querySelectorAll('input')[1], {
        timeValidator: rome.val.except(['10:37', '12:32', '14:04'])
    });

    //10:37 - 12:32 not selectable
    rome(document.querySelectorAll('input')[2], {
        timeValidator: rome.val.except('10:37', '12:32')
    });

    //09:56 and 10:37 - 12:32 not selectable
    rome(document.querySelectorAll('input')[3], {
        timeValidator: rome.val.except(['09:56', ['10:37', '12:32']])
    });

    //10:37 only selectable
    rome(document.querySelectorAll('input')[4], {
        timeValidator: rome.val.only('10:37')
    });

    //10:37, 12:32 and 14:04 only selectable
    rome(document.querySelectorAll('input')[5], {
        timeValidator: rome.val.only(['10:37', '12:32', '14:04'])
    });

    //10:37 - 12:32 only selectable
    rome(document.querySelectorAll('input')[6], {
        timeValidator: rome.val.only('10:37', '12:32')
    });

    //09:56 and 10:37 - 12:32 only selectable
    rome(document.querySelectorAll('input')[7], {
        timeValidator: rome.val.only(['09:56', ['10:37', '12:32']])
    });