laptop and a wrench

漏洞

Javascript API Layer Definition does not work correctly with datetime values.

上次发布: August 25, 2014 ArcGIS API for JavaScript
漏洞 ID 编号 NIM038387
已提交September 11, 2008
上次修改时间June 5, 2024
适用范围ArcGIS API for JavaScript
找到的版本9.3
状态Duplicate

附加信息

Duplicate of NIM042471. At 10.0 REST API supports input in JSON representation for defintion query which should be used for this case.

解决办法

1) add a new field (in the database) to store a numeric date representation (float, e.g.).2) convert values in the date field to the new numeric field.3) alter javascript code according to the following example to apply the definition based on the numeric field values (without any conversion of dates whatsoever):layerDefs[0] = "DateFloat < 20071231235900"; //value is: YYYYMMDDhhmmssYou could also store datetime values in a float field in the same format used by the JavaScript getTime() function (milliseconds since midnight of 1/1/1970). Use getTime() in the application to convert the desired datetime for the layer definition. Something like:d = new Date();d.setMonth(12);d.setDate(31);d.setYear(2007);d.setHours(23);d.setMinutes(59);d.setSeconds(0);time = d.getTime();layerDefs[0] = "DateMS > " + time;

重现步骤

漏洞 ID: NIM038387

软件:

  • ArcGIS API for JavaScript

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

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

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项