jquery mobile - Mobiscroll Default Date Value on Safari -
i'm using mobiscroll date scroller in app. have set initialize date database , set value of input field. here 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 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 date formatted in text input , defaults date when mobiscroll opened. except in safari. in safari date shows nan/nan/nan. how fix this? thanks!
you don't need call setdate
, put date in correct format input value. see example: http://jsfiddle.net/rqzbw/
note 1: use 'mdyy'
, 'm/d/yy'
, yyyy
incorrect (see documentation)
note 2: .scroller()
deprecated, use .mobiscroll()
instead. if using older version, should upgrade latest.
Comments
Post a Comment