Select to view content in your preferred language

Date Picker

2448
4
09-08-2010 04:25 AM
KathleenBrenkert
Regular Contributor
I noticed yesterday that when I use a date field in my attribute inspector, it will display the date I enter minus 1 day.  So if I pick Sept 8, close my attribute inspector and reopen it-Sept 7 is displayed.  The date in my database is stored as Sept 8. 
I noticed this sample is displaying the same behavior for me: http://help.arcgis.com/en/webapi/flex/samples/index.html

My system calendars/clocks as far as I know are correct.  Is this a bug in the 2.0 library or my system?

my set up for this field is pretty basic.  The following is contained within the AttributeInspector tags (ZInspect is a date field):
<esri:FieldInspector featureLayer="{myFeatureLayer}" fieldName="ZInspect"/>
Tags (2)
0 Kudos
4 Replies
DasaPaddock
Esri Regular Contributor
This is a AGS 10.0 REST bug. Were you referring to this sample?
http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=AttributeInspectorInfoWindowEditable

Here's a workaround:

            private function myFeatureLayer_selectionCompleteHandler(event:FeatureLayerEvent):void
            {   
                // only show infoWindow if a feature was found
                if (event.featureLayer.numGraphics > 0)
                {
                    status.text = "Feature selected";
                    for each (var field:Field in event.featureLayer.layerDetails.fields)
                    {
                        if (field.type == Field.TYPE_DATE)
                        {
                            for each (var feature:Graphic in event.features)
                            {
                                var date:Date = new Date(feature.attributes[field.name]);
                                if (date.milliseconds == 999)
                                {
                                    date.milliseconds++; //Add 1ms to date values ending in 999 to workaround REST date bug
                                    feature.attributes[field.name] = date.time;
                                }
                            }
                        }
                    }
                    myMap.infoWindow.show(queryMapClick.geometry as MapPoint);
                }
                else
                {   
                    if (!status.text == "Feature deleted.") //avoid showing the alert box, immediately after deleting
                    {
                        status.text = "";
                        Alert.show("Sorry found nothing here...");
                    }
                }
            }
0 Kudos
KathleenBrenkert
Regular Contributor
That is the sample, and the fix worked like a charm!
thanks!
0 Kudos
KathleenBrenkert
Regular Contributor
My date picker is also defaulting to 12/29/1899 when the field is null.  How do I set the date picker to start with a more resonable date, say today's?
0 Kudos
DavidCaussin
Deactivated User
Hi all,

Is it possible to change the date format MM/DD/YYYY in DD/MM/YYYY?

I already change the date format on the server where arcgis server is running but that change nothing

Thanks a lot.

David
0 Kudos