@gibMoment.jsでの提案に感謝します。この小さなライブラリは、日付とJavaScriptの処理に非常に役立ちます。
Moment.jsは、私も抱えていた元の質問で説明されている問題を解決しました。IE8は、新しいDate()オブジェクトに解析されたときに、JSONISO日付をNaNとして表示していました。
クイックソリューション(ページにmoment.jsを含めるか、コードをjs関数にコピーします)
JSON ISO日付からロードされた日付をページに表示する必要がある場合は、次のようにします。
order_date = moment(data.OrderDate); //create a "moment" variable, from the "data" object in your JSON function in Protoype or jQuery, etc.
$('#divOrderDate).html(order_date.calendar()); //use Moment's relative date function to display "today", "yesterday", etc.
また
order_date = moment(data.OrderDate); //create a "moment" variable, from the "data" object in your JSON function in Protoype or jQuery, etc.
$('#divOrderDate).html(order_date.format('m/d/YYYY')); //use Moment's format function to display "2/6/2015" or "10/19/2014", etc.
Date()オブジェクトが必要な場合(たとえば、jQueryコンポーネントで使用する場合)、次の手順を実行して、JSONで提供されるISO日付を正常に入力します。(これは、JSONデータを処理する関数の内部に既にいることを前提としています。)
var ship_date = new Date(moment(data.ShipDate).format('m/d/YYYY')); //This will successfully parse the ISO date into JavaScript's Date() object working perfectly in FF, Chrome, and IE8.
//initialize your Calendar component with the "ship_date" variable, and you won't see NaN again.