Closed prashastk closed 5 years ago
Good point. The date format is a string following any of the options specified by ISO 8601. We usually use the following format: "Mon Aug 7 10:59:24 PDT 2017", so this format is the one we tested the most.
Example:
"AddEntity" : {
"class" : "Visit",
"_ref": 4567,
"properties" : {
"start": {"_date": "Mon Aug 7 10:59:24 PDT 2017"}
"end": {"_date": "Mon Aug 7 12:59:24 PDT 2017"}
}
}
A date value will be returned as an ISO 8601 standard representation of time in servers timezone.
It also looks like _date doesn't allow milliseconds and truncates it to just seconds?
I see that we actually go to the granularity of microsecond. Can I see the date string that you are working with?
I didn't find details about the ISO 8601 "Mon Aug 7 10:59:24 PDT 2017" format.
https://en.wikipedia.org/wiki/ISO_8601 mentions 2019-03-07T16:20:24+00:00 which is what python produces by default so I used that.
Inserted entity using:
[{'AddEntity': {'_ref': 4567,
'class': 'Visit',
'properties': {'end': {'_date': '2018-12-06T04:04:02.123'},
'start': {'_date': '2018-12-06T04:04:01.001'}}}}]
Queried using:
[{'FindEntity': {'class': 'Visit', 'results': {'list': ['start', 'end']}}}]
[{'FindEntity': {'entities': [{'end': '2018-12-06T04:04:02+00:00', 'start': '2018-12-06T04:04:01+00:00'}], 'returned': 1, 'status': 0}}] []
The milliseconds component is missing in the response.
I am looking at the code and it seems everything is in place for mili seconds. We will look deeper and add tests cases for this and fix.
Fixed in PMGD # 37 and added a test case in #99
What are the supported _date formats? Would be good to mention that in the wiki.