Setting DATE_IMPORT_EXPORT_FORMAT for Collector

19 views
Skip to first unread message

Angela Labrador

unread,
Apr 1, 2020, 4:55:40 PM4/1/20
to Arches Project
Hi everyone, 

I'm running into a problem syncing a date using the Collector app in Arches 5 (and previously in 4). I'm getting the following error:

arches.app.models.tile.TileValidationError: '2020-04-02T00:00:00.000-04:00 None is not in the correct format, make sure it is in this format:                             %Y-%m-%d or set the date format in settings.DATE_IMPORT_EXPORT_FORMAT. This data was not imported.'


and so I added in my settings_local.py file:
DATE_IMPORT_EXPORT_FORMAT = ['%Y-%m-%dT%H:%M:%S.%fZ', '%Y-%m-%dT%H:%M:%S.%f%z %Z', '%Y-%m-%dT%H:%M:%S.%f%z', '%Y-%m-%dT%H:%M:%S.%-f%z %Z']


However, none of these match the format string (I'm most unsure of the last portion with the milliseconds and time zone). 

Back in the Arches' project resource model, the node is datatype = date, and the card widget is using date format ISO 6801 YYYY-MM-DD. No project overrides on any of these. In the collector app, I get the standard pop up calendar and can choose a date (no time). 

Grateful for ideas. Thanks,
Angela

Alina Myklebust

unread,
Apr 3, 2020, 9:05:14 PM4/3/20
to Arches Project
Hi Angela,

I also experienced a similar issue with syncing dates using the Collector app in version 4.4.3.  If I recall correctly, the issue was logged in Github.  

I'll check with the app developers to see if there is an update.  

Best,

Alina

Angela Labrador

unread,
Jun 4, 2020, 4:43:29 PM6/4/20
to Arches Project
Thanks, Alina! 

I've coded a workaround that parses the date, at least according to the formats that I've encountered on a few different android and ios devices. It's probably not robust enough for a pull request, but if anyone else has been dealing with this problem, I'm happy to explain what I did (edits are mainly in https://github.com/legiongis/arches/blob/stable/5.0.x-fpan-dateparse/arches/app/datatypes/datatypes.py and  https://github.com/legiongis/arches/blob/stable/5.0.x-fpan-dateparse/arches/app/models/mobile_survey.py)

Angela
Reply all
Reply to author
Forward
0 new messages