I am having issues with my postgresql dates. I a column with type date
. An example value in the column is 2016-01-28
. However, when I make an AJAX request to retrieve data from the server, the date is returned as "2016-01-28T07:18:01.000Z"
. Does anyone know why the additional T07:18:01.000Z
is there and how I can prevent it?
The only workaround I know is to use the dateformat
package (https://www.npmjs.com/package/dateformat) to parse the date once it is returned from the AJAX request - but i'd rather not do it if I can return the date without the additional T07:18:01.000Z
.
Here is my query:
knex('reports')
.where({
projectid: req.params.id
})
.then(function(data) {
console.log(data)
console.log(data[0].start_date //returns "2016-01-28T07:18:01.000Z"
res.send(data)
});
Thanks in advance!