Cleanest way to tell if 3 times are within half an hour of each other

Posted by niggles on Stack Overflow See other posts from Stack Overflow or by niggles
Published on 2010-04-08T02:59:32Z Indexed on 2010/04/08 3:03 UTC
Read the original article Hit count: 325

Filed under:
|

I have 3 date / time input boxes on a form and the user cannot select any times within half an hour of each other.

I've converted all values to epoch format using a Javascript implementation of strtotime, but not sure how to recursively check that any of the times are actually half an hour apart.

I can hand code all checks, but it would be cleaner to write a recursive function (especially if there were theoretically more than 3 time slots).

Did some Google research but no luck.

Any suggestions on implementing this in Javascript or Jquery.

Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery