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 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项