-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for dates (parsing + serializing) #82
Comments
thanks! |
@romaluca Did that solve your problem? In general, my idea for the solution to this problem would be as follows:
The first change would be a breaking change, but shold be helpful. We still have to decide on the data type to use. The second change could be implemented right away without any downsides. |
@ocram |
@Tailmaters I'm afraid that is not really enough information for us to know what's your problem. Does your server expect a "{ \"$date\": "+date.getTime()+" }" Otherwise, your problem is not really relate to this issue.
That doesn't mean anything! What works on iOS is probably unrelated to what's working on Android. |
@ocram |
In general, I prefer public discussions here in the issues which help everybody using this library. If someone has the same problem later, they can benefit as well. My email address can be found by going to the website linked in my profile and choosing "Contact". |
Meteor stores dates as timestamps in milliseconds. The appropriate Java type would be
long
.But when a client communicates with the server, the server always sends them in another form and expects them in the same form when it receives data from the client.
What Meteor does is wrapping a plain timestamp such as
1459443366000
in a JSON object containing the date as a property, such as{ "$date": 1459443366000 }
.So when you receive a date, the value is not the timestamp itself but the JSON object that you must parse the date from, first.
And when you try to send a date, you can't just put the timestamp right in there but must wrap it in a JSON string, e.g.
myMap.put("myDate", "{ \"$date\": 1459443366000 }");
.We should add built-in support to make this easier.
The text was updated successfully, but these errors were encountered: