{"action":"created","issue":{"url":"https://api.github.com/repos/automategreen/dynamoose/issues/59","repository_url":"https://api.github.com/repos/automategreen/dynamoose","labels_url":"https://api.github.com/repos/automategreen/dynamoose/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/automategreen/dynamoose/issues/59/comments","events_url":"https://api.github.com/repos/automategreen/dynamoose/issues/59/events","html_url":"https://github.com/automategreen/dynamoose/issues/59","id":172627085,"number":59,"title":"Example on querying Date field","user":{"login":"davidhouweling","id":9696959,"avatar_url":"https://avatars.githubusercontent.com/u/9696959?v=3","gravatar_id":"","url":"https://api.github.com/users/davidhouweling","html_url":"https://github.com/davidhouweling","followers_url":"https://api.github.com/users/davidhouweling/followers","following_url":"https://api.github.com/users/davidhouweling/following{/other_user}","gists_url":"https://api.github.com/users/davidhouweling/gists{/gist_id}","starred_url":"https://api.github.com/users/davidhouweling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidhouweling/subscriptions","organizations_url":"https://api.github.com/users/davidhouweling/orgs","repos_url":"https://api.github.com/users/davidhouweling/repos","events_url":"https://api.github.com/users/davidhouweling/events{/privacy}","received_events_url":"https://api.github.com/users/davidhouweling/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-23T07:08:37Z","updated_at":"2016-08-24T00:07:32Z","closed_at":null,"body":"Could you provide an example of how to perform a query on an established date field? This is what I have so far, but it errors out with the exception `A value provided cannot be converted into a number stack: ValidationException: A value provided cannot be converted into a number`.\r\n\r\nOriginally I tried passing just the `Date` object which didn't work, and as reading the docs go, it mentions that you convert Date to a Number, so i checked the `lib` folder and saw you were using `.getTime()` to do the conversion, but in essence `.valueOf()` is the same thing.\r\n\r\n``` js\r\nconst date = Date.now;\r\nreturn Test.query({\r\n    date: {\r\n      ge: date.valueOf()\r\n    }\r\n  }, (err, outages) => {\r\n    if (err) {\r\n      console.log(err);\r\n      return;\r\n    }\r\n    console.log('success');\r\n  });\r\n```\r\n\r\nAlso, how would I be able to perform multi-condition query on the same field. For example, I would like to have a `ge` and `le` on the `date` field, would it merely just be extending the object accordingly?"},"comment":{"url":"https://api.github.com/repos/automategreen/dynamoose/issues/comments/241920523","html_url":"https://github.com/automategreen/dynamoose/issues/59#issuecomment-241920523","issue_url":"https://api.github.com/repos/automategreen/dynamoose/issues/59","id":241920523,"user":{"login":"davidhouweling","id":9696959,"avatar_url":"https://avatars.githubusercontent.com/u/9696959?v=3","gravatar_id":"","url":"https://api.github.com/users/davidhouweling","html_url":"https://github.com/davidhouweling","followers_url":"https://api.github.com/users/davidhouweling/followers","following_url":"https://api.github.com/users/davidhouweling/following{/other_user}","gists_url":"https://api.github.com/users/davidhouweling/gists{/gist_id}","starred_url":"https://api.github.com/users/davidhouweling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidhouweling/subscriptions","organizations_url":"https://api.github.com/users/davidhouweling/orgs","repos_url":"https://api.github.com/users/davidhouweling/repos","events_url":"https://api.github.com/users/davidhouweling/events{/privacy}","received_events_url":"https://api.github.com/users/davidhouweling/received_events","type":"User","site_admin":false},"created_at":"2016-08-24T00:07:32Z","updated_at":"2016-08-24T00:07:32Z","body":"Sorry, i tried to dumb it down a bit by abstracting the fact I was using `moment.js`. With the below though, it just hangs. `exec` callback never gets fired.\r\n\r\nOne thing to also note is that I have not yet put anything in the table. Do you think that could also be a problem?\r\n\r\n``` js\r\n  const date = moment().subtract(14, 'days');\r\n  return Test\r\n    .query('date')\r\n    .between(date.valueOf(), date.clone().add(14, 'days').valueOf())\r\n    .exec((err, result) => {\r\n      console.log('exec callback');\r\n      if (err) {\r\n        console.log('errored');\r\n        console.log(err);\r\n        return;\r\n      }\r\n      console.log('success');\r\n      console.log(result);\r\n    });\r\n```"}}
{"actor":{"display_login":"davidhouweling"}}