laptop and a wrench

Error

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

Última publicación: August 31, 2014 ArcGIS API for JavaScript
Número de ID del error NIM079740
EnviadoApril 6, 2012
Última modificaciónJune 5, 2024
Relacionado conArcGIS API for JavaScript
Versión encontrada10.0
Lenguaje del programaJavaScript
Sistema operativoWindows OS
Versión de sistema operativo7
EstadoWill Not Be Addressed

Información adicional

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

Solución alternativa

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" });

}

Pasos para reproducir

ID del error: NIM079740

Software:

  • ArcGIS API for JavaScript

Recibir notificaciones cuando cambie el estado de un error

Descargar la aplicación de soporte de Esri

Descubrir más sobre este tema

Obtener ayuda de expertos en ArcGIS

Contactar con el soporte técnico

Descargar la aplicación de soporte de Esri

Ir a opciones de descarga