Closed BWibo closed 2 years ago
Good catch!
This is a result of the way I implemented date parsing.
This has been mainly done to allow easy input of dates in the cli-modes without requiring a rigid date format.
Since it is natural for me to have the date formatted as DD.MM.YYYY
I used the flag dayfirst
for the dateutil.parser
to allow for such dates.
I'm not sure how to handle this properly, do you have any thoughts to that effect?
I think regarding date/time formats it really depends on one's background what feels "natural". Hence, to make it work for everybody, some kind of convention is required.
I personally would stick to the same format that is used by the SensorThingsAPI, because this is what feels most natural too me here. stapy
is for SensorthingsAPI, so I would expect the same date format as in the standard.
Maybe it is possible to add some convenience functions, e.g. to make parsing dates without time easier.
Thanks for the issue and input regarding the resolution of the problem @BWibo :+1:
Nevermind, thx for this library and the quick fix. I just did some testing and can confirm the date time format %Y-%m-%dT%H:%M:%S.%fZ
is now working.
Hey there,
I noticed some stange behavior when trying to POST Observations. I am not sure if this is my fault or if it is a bug. It appears to be the case, that somehow day and month are switched under certain circumstances when posting Observations. See the script below:
phenomenonTime = datetime.datetime.utcnow().strftime("%Y%m%dT%H%M%S.%fZ")
: When I use this as timestamp, the Observations ends up in the server with switched month and day.phenomenonTime = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
: This should work, right? It is the ISO date format that FROST accepts. Well, it does not. I get an error message :phenomenonTime = datetime.datetime.utcnow().strftime("%Y%d%mT%H%M%S.%fZ")
: this appears to be working fine. However, I switched month and day in the timestamp.I there something I'm missing or is this a bug?
Here is the script I used for testing:
python3 script.py 'https://my-frost-server.de/v1.1'
script.py