user2885746
user2885746

Reputation: 1

Problems with datepicker UI

I have 2 input fields, the first one is for a date picker and the second one for a time picker. If I choose in my date picker for Tuesday, Thursday, Friday, Saturday or Sunday then can I book a table up to 21 hours. If I choose for Wednesday then can I book a table up to 15 hours. It works temporary fine in Chrome and Firefox. In Safari and Internet Explorer can I only see the hours for Tuesday, Thursday, Friday, Saturday or Sunday.

I think my fault is here, but I can't find it.

var d = ($(this).val()).split("-"), newDate = [d[2], d[1], d[0]].join(",");

Here is a link to JSFiddle:

http://jsfiddle.net/za3Ap/107/

Upvotes: 0

Views: 71

Answers (1)

Jing
Jing

Reputation: 161

I think this is because when you call new Date(newDate), some browsers can't recognize "yyyy,mm,dd" format, try to create Date object by this: new Date(d[2], d[1]-1, d[0]).

Upvotes: 1

Related Questions