Jquery UI Datepicker wrong date in Safari only

I have discovered a strange bug where Jquery Ui is displaying the wrong date but only in Safari. For example I set the date to "2014-10-05" but the date picker in Safari is showing it as 2014-10-04. If I view source it shows the date value as 2014-10-05. If I use a different browser then it shows the correct date.

I have implemented using the following code:

<?php $event_date   = "2014-10-05"; ?> 
<script>
$(function() {
    $( "#event_date" ).datepicker();
    $( "#event_date" ).datepicker( "option", "dateFormat", "yy-mm-dd" );
    $( "#event_date" ).datepicker( "setDate", "<?php echo $event_date; ?>" );
});
</script>

<label for="event_date">Date</label> 
<input id="event_date" name="event_date" type="text" value="<?php echo $event_date; ?>" /> 
<em>(Event Date: <?php echo $event_date; ?>)</em>

This outputs the code as:

<input id="event_date" name="event_date" type="text" value="2014-10-05" class="hasDatepicker">

But Safari date picker is showing the date as October 4th! Other browser are fine.

You can see this happening in jFiddle:

http://jsfiddle.net/vLn0ttc8/


Jquery UI highlights both the current date and the one that you gave by the setDate method. It works ok. If you really think something's wrong, try updating jquery-ui

链接地址: http://www.djcxy.com/p/63124.html

上一篇: iOS版

下一篇: Jquery UI Datepicker仅在Safari中出现错误日期