In the date preset, it is possible to make invalid (not selectable) certain days of the week, days of the month, etc., as shown in this example: http://demo.mobiscroll.com/datetime/date#

Is it possible to do this with the time preset?

Ideally, I'd want to be able to do something like this, for example, which would make the times between 5pm and 9am not selectable:

    $('#scroller').mobiscroll({
        preset: 'time',
        display: 'modal',
        invalid: { timesBetween: ['17:00','08:59'] }
    );

I do realize it is possible to create a custom set of wheels and only populate them with selections that I want. However that does not address my needs the same way this would.

有帮助吗?

解决方案

Starting with the 2.8 Release, invalid for times got introduced. You can set it for certain days, daysOfWeek, Month, recurring days.

Example:

invalid: [
    '1/1', // 1st of January disabled
    '12/24', // Christmas disabled
    '12/25', // Christmas disabled
    'w0', // Sundays disabled
    { start: '00:00', end: '08:00' }, // Every day
    { start: '16:00', end: '23:59' }, // Every day
    { d: 'w6', start: '00:00', end: '08:59' }, // Saturday
    { d: 'w6', start: '17:00', end: '23:59' } // Saturday
]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top