jonthornton / Datepair.js

A javascript plugin for intelligently selecting date and time ranges, inspired by Google Calendar.
https://www.jonthornton.com/Datepair.js
359 stars 85 forks source link

Is there a way to disable 0 mins? #36

Closed triodo closed 9 years ago

jonthornton commented 9 years ago

I don't understand. Could you explain more?

triodo commented 9 years ago

In the “time end” I have a duration with 30 min step, I want to disable 0 min. I choose "time start" 2:00 and I want the "time end" to always be more than 2:00 so that I can not choose 0 min. (2:30; 3:00; 3:30 ...)

triodo commented 9 years ago

Did you understand what I write?

jonthornton commented 9 years ago

Datepair doesn't implement this kind of functionality, but you can do it reactively with an event handler.

var datepair = new Datepair(....);
$('#someDatepair').on('rangeSelected', function(){
    if (datepair.getTimeDiff() <= 0) {
        // alert user, adjust values, etc
    }
});