Default Date Value on Safari

28 views
Skip to first unread message

Amanda Collins

unread,
Jul 23, 2013, 3:54:34 PM7/23/13
to mobis...@googlegroups.com
I'm using mobiscroll date scroller in an app. I have it set up to initialize to a date I get from the database and set as the value of my input field. Here is my code:

$(function(){
$("#requestDate").scroller({ 
preset: 'date',
theme: 'jqm',
display: 'modal',
mode: 'scroller',
dateOrder: 'mdyyyy',
dateFormat: 'm/d/yyyy'
});

var requestDate = $("#requestDate").val();
if(requestDate != ""){
requestDate = new Date(requestDate);
$("#requestDate").scroller('setDate', requestDate, true);

});

Here is my form field:
<input type="text" name="requestDate" id="requestDate" data-role="mobiscroll" value="2013,7,25" data-mini="true" readonly="" class="ui-input-text ui-body-f ui-corner-all ui-shadow-inset ui-mini">

This shows the date formatted in the text input and defaults to that date when mobiscroll is opened. Except for in Safari. In safari the date shows as NaN/NaN/NaN. How do I fix this?
Thanks!

Reply all
Reply to author
Forward
0 new messages