不要怂,就是干,撸起袖子干!

Commit e7ec0efe by Seth Samuel

Use moment for better postgres timestamp strings

1 parent db558b8e
Showing with 2 additions and 3 deletions
...@@ -3,6 +3,7 @@ var Utils = require("../../utils") ...@@ -3,6 +3,7 @@ var Utils = require("../../utils")
, DataTypes = require("../../data-types") , DataTypes = require("../../data-types")
, tables = {} , tables = {}
, primaryKeys = {} , primaryKeys = {}
, moment = require("moment")
module.exports = (function() { module.exports = (function() {
var QueryGenerator = { var QueryGenerator = {
...@@ -680,9 +681,7 @@ module.exports = (function() { ...@@ -680,9 +681,7 @@ module.exports = (function() {
}, },
pgSqlDate: function (dt) { pgSqlDate: function (dt) {
var date = [ dt.getUTCFullYear(), this.padInt(dt.getUTCMonth()+1), this.padInt(dt.getUTCDate()) ].join('-') return moment(dt).format("YYYY-MM-DD HH:mm:ss.SSS Z")
var time = [ dt.getUTCHours(), this.padInt(dt.getUTCMinutes()), this.padInt(dt.getUTCSeconds())].join(':')
return date + ' ' + time + '.' + ((dt.getTime() % 1000) * 1000) + 'Z'
}, },
pgDataTypeMapping: function (tableName, attr, dataType) { pgDataTypeMapping: function (tableName, attr, dataType) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!