opensrp / opensrp-server

OpenSRP backend
https://smartregister.atlassian.net/wiki/display/Documentation/OpenSRP+Developer%27s+Guide
Other
24 stars 37 forks source link

Created datetime for date fields are not consistent in client and event documents #384

Open sohelsarder opened 6 years ago

sohelsarder commented 6 years ago

In opensrp v2 from server created date field in client and event documents are not setting properly, i.e "type": "Event", "dateCreated": "2018-02-25T07:57:00.741Z",-----this is GMTtime "dateEdited": "2018-02-25T13:57:31.134+06:00",----this time is setting according to server time zone "serverVersion": 1519545420741,--- ,-----this is equivalent of GMTtime

same is happing for client documents.

This is very serious issues and could create confusion during data analysis and implementation across different site. Server is in proper time zone this need to be fixed from code.

sohelsarder commented 6 years ago

This problem ideally should exist for every opensrp implementation. @keymane @githengi can you please check from your data and confirm?

craigappl commented 6 years ago

@sohelsarder, @keymane and @githengi, I can confirm that this is the case in ZEIR Staging:

Sample Child Registration form fields: "dateCreated": "2018-02-07T14:27:54.156Z", "dateEdited": "2018-02-07T14:31:23.339+02:00", "serverVersion": 1518006659097,

This also appears to be event specific. The New Woman Registration Form has a dateCreated field with the timezone data. Sample New Woman Registration: "type": "Event", "dateCreated": "2018-02-07T17:52:58.665+02:00",

Recurring Service events do not have Time Zone data: "dateCreated": "2018-02-07T12:46:17.126Z", "dateEdited": "2018-02-07T11:03:24.421Z",

Vaccination events do: "type": "Event", "dateCreated": "2018-02-07T14:30:58.614Z", "dateEdited": "2018-02-07T14:31:28.094+02:00",

I dug around and found that this could be a problem in a couple of different places.

Craig