次のコードは、jQuery UI の日付ピッカーに対して実行されます。JSON 応答にその日付のデータが含まれているかどうかに基づいて、日付が強調表示されます。これは Chrome (32.0.1675.2 カナリア) では正常に機能しますが、Firefox では機能しません。その理由を知っている人はいますか?ハイライトクラスはFFでは追加されません。
function( response ) {
MyApp.events = response;
//console.log(events[1]);
$("#my-event-calendar" ).datepicker({
beforeShowDay: function(date) {
var result = [true, '', null];
var matching = $.grep(MyApp.events, function(event) {
//console.log(new Date(event.Date).valueOf() );
dateToHighlight = new Date(event.Date).valueOf();
return dateToHighlight === date.valueOf();
});
if (matching.length) {
result = [true, 'highlight', null];
}
return result;
},
Chrome ではconsole.log(new Date(event.Date).valueOf() );
レンダリングし1380582000000
ますが、Firefox ではこれは-1775005200000
更新、JSON データは次のようにフォーマットされます。
オブジェクト {日付: "2013-10-02T14:30:00+00:00", タイトル: "イベントのタイトル"}