Pg-promise: Timestamp without timezone and JS Date

Created on 4 May 2016  路  15Comments  路  Source: vitaly-t/pg-promise

Hi,

I have exactly the same problem using pg-promise as described here: http://stackoverflow.com/questions/20712291/use-node-postgres-to-get-postgres-timestamp-without-timezone-in-utc

How to solve it with pg-promise? Can I disable timestamp to JS Date conversion?

Thanks.

question

Most helpful comment

Should be better now ;)

All 15 comments

Why not use the very solution that's already published there?

var pgp = require('pg-promise')({
    // initialization options
});

pgp.pg.types.setTypeParser(1114, function (stringValue) {
    return stringValue;
});

// In ES6 syntax:
// pgp.pg.types.setTypeParser(1114, s=>s);

Thanks, the solution is fine. Now I know how to access the pg instance.

Some minor issue with the website, bwt

screen shot 2016-05-04 at 1 15 05 pm

Some caching issues perhaps? Try Ctrl+0, and then Ctrl+F5 ;)

I see the same issue with the website. Hard refresh renders no change.

That is in interesting. I have here all browsers (Chrome, FireFox, IE), none of them show the problem your showed me. I wonder now how to reproduce this issue...

I have just updated it slightly. Does it look any better?

Yes it does. No more overlapping. 馃憤

Yes, no overlapping. I am on Chrome Version 50.0.2661.94 (64-bit), Mac version.
But still the font size is too big and the entire left menu does not fit the screen and it is not scrollable.

screen shot 2016-05-04 at 1 36 31 pm

@vitaly-t if you want I could tackle that next week for you. I am a front end dev by trade ;)

@ferdinandsalis thank you! so am I :) It's just that I do not see the problem here, which is what makes it harder to fix.

That API website is automatically generated, I am limited to a single CSS file that I'm tweaking.

I have just updated it again, reduced the overall font size. Might look better now ;)

Yes better. Though I still can鈥檛 scroll the list on the left when my window size is not heigh enough. Giving the .nav container a fixed height, e.g. position: fixed; top: 0; bottom: 0; and setting the overflow-y: scroll should do the job.

Should be better now ;)

Why not use the very solution that's already published there?

var pgp = require('pg-promise')({
    // initialization options
});

pgp.pg.types.setTypeParser(1114, function (stringValue) {
    return stringValue;
});

// In ES6 syntax:
// pgp.pg.types.setTypeParser(1114, s=>s);

Thanks for your comment. One cent: to force node-pg-types to parse TIMESTAMPTZ (1184) to the same value answered by PostgresQL use the same function but replace 1114 to 1184. I love the way postgresql deals with timestamptz so I always prefer to rely on it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alpertuna picture alpertuna  路  4Comments

illarionvk picture illarionvk  路  3Comments

blendsdk picture blendsdk  路  3Comments

msjoshi picture msjoshi  路  4Comments

ForbesLindesay picture ForbesLindesay  路  3Comments