MG REST GET Features for datetime fields

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

MG REST GET Features for datetime fields

Alen
Using MG REST requests,
when I use GET feature (http://xxx.FeatureSource/features.geojson/xxx/xxx) for features with TIMESTAMP data it returns json with date string:  "TIMESTAMP '2016-08-20 22:34:52'"
But when I update feature data with POST I need to have timestamp string formatted like that: "2016-08-20 22:34:52
 I think it would be more consistent if GET features returns the same string form ("2016-08-20 22:34:52") as string format needed for POST requests.
(Or is it by design?)

Also I noticed that GET feature request returns some fractions of the second from date fields which are not written in the feature source timestamp values, like that:
"TIMESTAMP '2000-01-01 20:34:02.04601'" while real value is "TIMESTAMP '2000-01-01 20:34:02'" so fractions of the second comes from nowhere ?
Reply | Threaded
Open this post in threaded view
|

Re: MG REST GET Features for datetime fields

GordonL
You can always tweak the geojson adaptor to format the date in the way you need.

https://github.com/jumpinjackie/mapguide-rest/blob/master/app/adapters/geojsonadapter.php

(around line 153)

gordon
Reply | Threaded
Open this post in threaded view
|

Re: MG REST GET Features for datetime fields

Alen
Yes line 153 returns string in FDO format, ( "TIMESTAMP 'yyyy-mm-dd hh:mm:ss.sss'" ) so one can just remove "TIMESTAMP " from the beginning of the string and everything after "." if needed.
Anyway i posted an issue on that matter:
https://github.com/jumpinjackie/mapguide-rest/issues/142
Reply | Threaded
Open this post in threaded view
|

Re: MG REST GET Features for datetime fields

GordonL
I am running into this today.  I have a date field, and I have a
"_html_single.tpl" that I am using to edit with REST.

TIMESTAMP '0000-00-00 00:00:00' is the default.

I need to add a date and send it back, but I can't for the life of me get
the date format to be accepted by mapguide-rest

Unhandled Exception
Invalid date string: 03/31/2020 at C:\Program
Files\OSGeo\MapGuide\Web\www\rest\app\util\utils.php:702



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: MG REST GET Features for datetime fields

GordonL
Nevermind, mapguide-rest needs "YYYY-MM-DD HH:mm:ss" but jQuery UI Date
Picker does not have time...

Just user error on my part.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users