Default date value in ArcGIS Online says 'Invalid Date' which defaults to 1899

2732
7
01-23-2020 12:32 PM
by Anonymous User
Not applicable

We have a feature service which is published to ArcGIS Online. We didn't specifically set default dates in Pro before publishing.

We noticed that new records had these dates set to 30 Dec 1899.

When we check the field information in ArcGIS Online, we noticed that the "default value" says "Invalid Date". However, if we open up the feature service in Pro and look at it in the Design Fields view, it says the default value is "30 Dec 1899".

What we actually want is for the date to default to a null/undefined value. Can anyone explain a) what is currently going on with the "invalid date" vs "30 dec 1899" confusion, and b) how would we change this to default to null?

View from Pro:

inline screenshots might not be displaying for some reason so I have tried to add them as an attachment....

Tags (3)
0 Kudos
7 Replies
JosephEfenecy
Esri Contributor

Hey @Paul Haakma,

Sorry to hear you are running into some issues with Date Fields, typically in ArcGIS Online or in ArcGIS Enterprise the date fields default to 1899 when they are set to "not null" as it needs date information (seen a required). There is also a required format desired so there may have been some mismatch provided and why you see the difference in ArcGIS Online and ArcGIS Pro.

I would double check that the date field is not marked as a required field and thus allowing null values, the document below details some of the expected behavior with date fields. 

Work with date fields—ArcGIS Online Help | Documentation 

0 Kudos
LisaCasey
New Contributor III

Joseph - Do you know if there is a way to set a default date value, while still not allowing null values (this in enterprise 10.5.1, not AGOL)? The 1899 date is throwing off some of your users... thanks so much!

0 Kudos
by Anonymous User
Not applicable

Hi Joseph

So there shouldn't have been any default value, but I double checked the json of the feature service endpoint and noticed that there WAS a defaultValue set for these date fields, all set to:

"defaultValue" : "-2209161600000"
So obviously something has gone wrong in the publishing process. So the next thing I tried was using the updateDefinition api to change the defaultValue, but the defaultValue refuses to update for some reason (even though the response says it was successful). I was able to successfully change other things (such as the field alias) but not the default value for some reason. I wonder if anyone knows why this might be? Is there some reason the api won't update the default value for a date field?
0 Kudos
MichelleDuncan2
New Contributor III

We have a feature service that just started doing this too. Our data is set to accept null values for the date fields. It wasn't doing this before.  

0 Kudos
JosephEfenecy
Esri Contributor

It would be weird for it to change on its own without there being some other update elsewhere. 

  1. Is the feature service in ArcGIS Enterprise or ArcGIS Online?
  2. Are there any domains / subtypes that do have Default values (aka set to "Not Null")
0 Kudos
JosephEfenecy
Esri Contributor

Paul Haakma

I have not seen that exact behavior before, however, if it is in use I have seen this failure at times for other parameters that have been attempted to be updated. 

That default value again should be enforced when Null values are not allowed for that date field. Additionally, if there are any domains or subtypes for a date field that are set to "Not Null" this can cause the issue as well. 

As a test it would be best to republish the dataset and verify from ArcGIS Desktop or ArcGIS Pro that no Date Fields have any defaults and that there are no domains / subtypes present that could be affecting this. 

0 Kudos
TravisSizemore
Occasional Contributor

Hello, 

Has anyone found a solution to this other than to republish? I have a feature service with multiple layers that just began setting the defaultValue for three different date fields to the 1899 date mentioned above. None of the layers are useable anymore, and this feature service is used in 6 different maps and 3 different web apps. It would be a major task to republish and rebuild all of this, then months of debugging. I have tried updateDefinition in the REST API as mentioned above, but it won't take. None of the date fields are required fields, nor do I have any templates with these dates as required fields. I have not tried to reset the value range for these layers because doing so would require deleting 13 different views that these maps/apps use. I'm hoping there's an easier solution.

If anyone has a fix, please help!

Travis

0 Kudos