Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Date values set from the client side are persisted as strings #42

Open
lackac opened this Issue · 1 comment

2 participants

@lackac

I have noticed this with the MongoDB backend, but I suspect this applies to other adapters as well.

Steps to reproduce:

  1. create a route which sets a date on some field: model.set("users.42.updated_at", new Date())
  2. access this route directly from the server
  3. look at the data persisted in the database, it should be something like this: "updated_at" : ISODate("2012-09-20T11:57:07.637Z")
  4. now access this from the client side (e.g. with a link pointing to '/')
  5. look at the data persisted in the database, it should be something like this: "updated_at" : "2012-09-20T11:57:03.243Z"

I suspect this is a side effect of how JSON.stringify and JSON.parse handles Date objects.

@lefnire

hear hear, it's a rather pain. has anyone figured out how to run mongo queries on these stringified dates as a result? eg, db.users.find({ 'auth.timestamps.created_on' : {$lt : new Date()} }) doesn't work because dates are strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.