laptop and a wrench

不具合

Updating the date field using the Attribute Inspector sample from ArcGIS API for Javascript 2.8 saves the incorrect dates.

最後に公開された状態: August 31, 2014 ArcGIS API for JavaScript
不具合 ID 番号 NIM079740
送信されましたApril 6, 2012
最終更新日June 5, 2024
適用対象ArcGIS API for JavaScript
見つかったバージョン10.0
プログラム言語JavaScript
オペレーティング システムWindows OS
オペレーティング システムのバージョン7
ステータスWill Not Be Addressed

参考情報

There are no plans to address this issue for an unsupported version.

対処法

Change the code to reflect the correct time zone. Since the feature is a UTC timestamp, the JavaScript code is converting to the users' timezone, which (assuming in the US) is four to seven hours earlier than midnight of 8/15/2007, which is why it is returning one day earlier.

As per the forum link:

<a href="http://forums.arcgis.com/threads/53385-SQLServer-datetime-field-doesn-t-translate-properly-as-javascript-date-object?highlight=date" target="_blank">http://forums.arcgis.com/threads/53385-SQLServer-datetime-field-doesn-t-translate-properly-as-javascript-date-object?highlight=date</a>

Below is the method which we need to use

function CustomDate(featureTime) {

console.log("formatting function called", featureTime);

// get the timezone offset from UTC time

var tzoffset = new Date().getTimezoneOffset();

// add the time zone offset to the timestamp

var utctime = dojo.date.add(new Date(featureTime), "minute", tzoffset);

return dojo.date.locale.format(utctime, { "selector": "date" });

}

再現の手順

不具合 ID: NIM079740

ソフトウェア:

  • ArcGIS API for JavaScript

バグのステータスが変更されたときに通知を受け取る

Esri Support アプリのダウンロード

このトピックについてさらに調べる

ArcGIS エキスパートのサポートを受ける

テクニカル サポートへのお問い合わせ

Esri Support アプリのダウンロード

ダウンロード オプションに移動