jonthornton / Datepair.js

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

Next day with only times #100

Closed KrunchMuffin closed 6 years ago

KrunchMuffin commented 6 years ago

Is there a way you can find out if the time range overlaps to next day when only using times? say something like 7pm (sept 20) - 2am (sept 21)

jonthornton commented 6 years ago

Datepair.js doesn't have anything built in to help with this, but you could do it by comparing the times:

if ($('#startTime').timepicker('getTime') > $('#endTime').timepicker('getTime')) {
  // the time range overlaps midnight
}