dimanche 22 février 2015

How to check a datetime duration exists in another datetime duration?

I am developing a Rails application for Examination management.


Exams can be created for a time period.


Exam model have the fields start_date:datetime and end_date:datetime


Exam creation is a 2 step process. In the first step all the exam details including start_date and end_date is given.


In the second step I want to list all exams that have a conflicting time period with the current exam so that the user can choose whether to continue or not.


Example:


Current exam:



Start date and time: "2015-02-23 10:30:00"

End date and time: "2015-02-23 13:30:00"


Conflicting exam:



Start date and time: "2015-02-23 12:30:00"

End date and time: "2015-02-23 14:30:00"


How is it possible?


Aucun commentaire:

Enregistrer un commentaire