Open ocram opened 8 years ago
thanks!
@romaluca Did that solve your problem?
In general, my idea for the solution to this problem would be as follows:
{ "$date": 1459443366000 }
string with a java.util.Date
or java.util.Calendar
instance, or a long
primitive.java.util.Date
or java.util.Calendar
instance into a Map
that is used in insert
, update
or remove
, it will be transformed into the corresponding JSON date string. Unfortunately, we can't do this for long
primitives, as we don't know if it's a date or something else.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 I am sending the date while subscribing but i will get the error "Match Failed" in android. the format i am sending is "1970-01-01 00:00:00 +0000". the same exact date format we are using in IOS it is working fine. can u please give a solution for this as soon as possible. Thank u
@Tailmaters I'm afraid that is not really enough information for us to know what's your problem. Does your server expect a Date
instance here? If so, send the date as a string, as shown above:
"{ \"$date\": "+date.getTime()+" }"
Otherwise, your problem is not really relate to this issue.
the same exact date format we are using in IOS it is working fine.
That doesn't mean anything! What works on iOS is probably unrelated to what's working on Android.
@ocram Can u please Share your email-id. We have some Issues with connecting and Fetching Data from the collections.we need to discuss with u how exactly it need to be done.
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.