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

Using datepair gives a valid date error #71

Closed piercemcgeough closed 8 years ago

piercemcgeough commented 8 years ago

The problem is that when we set the date to be data-rule-required="true" there is a random valid date error.

1) Pick a start date 2) Pick a start time 3) Change the preselected end time 4) Change start date….gives an error

Its strange because it seems to add a data-rule-date="true", I am assuming this because of the error returned. but I cannot see where this happens. Another thing is that once I select the next item, be it time or date and change them to be the same then the error will go away.

https://jsbin.com/zalibomisu/edit?html,output

jonthornton commented 8 years ago

I got an error that said "Please enter a valid time, between 00:00 and 23:59" when I tried the jsbin. Changing the timeformat to "h:i" made this go away.

piercemcgeough commented 8 years ago

Sorry I didn't have the settings exactly as I have them. That should be it correct now and showing the error.

There doesn't seem to be a steady reason for the error. The above steps didn't cause an error on some occasions but one way that I seem to always get it is the following:

1) Pick start date of the 10th of month or higher 2) Change start date to 9th of month or lower

This seems to always cause the error, but it may not be the same reason it causes another error. Another example is

1) Start date 17/3/2016 2) Start time 13:00 3) End time 15:00 4) Change start date 18/3/2016

https://jsbin.com/hexacuqide/edit?html,js,output

jonthornton commented 8 years ago

This doesn't appear to be a Datepair problem. If you comment out $('#datepairExample').datepair(); in your jsBin, the validation error still happens.

piercemcgeough commented 8 years ago

Ah so it does. Don't suppose you know a solution for it?

jonthornton commented 8 years ago

No, I'm not familiar with that validation plugin. Wish I could help!