Skip to content

Instantly share code, notes, and snippets.

@nDmitry
Created July 20, 2015 09:03
Show Gist options
  • Save nDmitry/6d7fa5c3e16141ee0b7e to your computer and use it in GitHub Desktop.
Save nDmitry/6d7fa5c3e16141ee0b7e to your computer and use it in GitHub Desktop.
var types = require('pg').types;
var TIMESTAMP_WOTZ = 1114; // timestamp without time zone
var PARSER = types.getTypeParser(TIMESTAMP_WOTZ);
types.setTypeParser(TIMESTAMP_WOTZ, function(val) {
var result = PARSER(val);
return val === null ? null : new Date(result - new Date().getTimezoneOffset() * 60 * 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment