When editing date attribute gets saved one day into the past

Discussion created by msbsmith on Oct 31, 2011
Latest reply on Dec 16, 2011 by dhollema

I have a problem with V2.5 of the JS API (although seems to be the same for previous versions).  The problem is editing and entering a date attribute which then gets saved to the database with a date one day into the past.  I have seen some similar forum posts about this, but not relating to the JS API, and not specifically like my problem ??? I will attempt to describe below.

Layers come from SDE V10, SP1 and some have date fields.  Using the out the box template picker and editor dijits (so no custom code) a user can place a point on the map and the attribute info window pops up and they can pick a date from the date picker.  If they pick today's date, or a date into the future then that date gets saved correctly into the database.  HOWEVER, if they pick a date in the past, then the date gets saved to the database one day further into the past.  For example a user selects 31/10/2011 in the date picker (and the current date is the same 31/10/2011) then this saves as you would expect as 31/10/2011 into the database, if they select 30/10/2011 (yesterday), this gets saved as 29/10/2011 in the database.  What's also interesting is that the value in the database is 29/10/2011, but when the user edits the point attributes using the info window, the displayed date is 30/10/2011.

This must have something to do with the info window attribute editor code, but as this is out of my control I don't know how to fix this problem.  It is very strange that only past dates exhibit this problem.  This is an issue because I want to store correct dates in the database of course.  I'm in the UK by the way which might have a bearing.

Can anyone please help solve this puzzle?

Thank you, Mark.