Issue with date fields
Hi! When I get a date field of an object using php sdk, it usually returns a dateTime and I was able to hadle it: (e.g.)
$now = new DateTime();
$diff = $now->diff($task->get("start"));
Now, with parse-server open source version, it returns a string that must be parsed in order to handle it.
Will take a look, the php sdk needs some changes anyway.
It's not a php issue, it's a parse-server issue. Parse-server must return an array like this when the field in the mongodb collection is a ISODate field:
{"__type":"Date","iso":"2016-02-29T08:00:00.000Z"}
but it's returning a string like 2016-02-29T08:00:00.000Z
only createdAt, updatedAt and expiresAt are returned like strings instead of {"__type":"Date","iso":""} why are you considering expiresAt as a special field? special fields are createdAt, updatedAt and objectId
Yup, valid bug, fix is incoming next week.
Just remove all expiresAt occurrences from transform.js in parse-server because expiresAt is not a magic field. Only magic fields are returned like strings and parsed in the sdk.
parse-server failed because I had a collection with a field named expiresAt.
Not as easy, but quite close. expiresAt is a magic field, but only for _Session objects. Also, we treat sub objects wrong, as well as convert all occurrences of typed Date objects into iso dates, where only root level should be converted.
We just hit this issue as well. Look forward to seeing the fix land.
Please reopen if you're still experiencing this with 2.1.2. Thanks.
Why is this thread closed? It's not fixed.
Not sure, but let's reopen to confirm.
So for reference:
In the hosted Parse.com server, the cloudcode was giving us: 2016-03-01T18:30:36.806Z. In the self-hosted parse server (most recent version: 2.1.3), it's giving: 2016-03-02 17:56:29 +0000.
Let me know if you need anything else.
We made some updates to expiresAt handling in recent versions, so this should be fixed now. Please open a new issue if you encounter the same problem.