Closed chauhankiran closed 10 months ago
This is more of a general PostgreSQL question and not related to anything specific to this client. There are many ways to skin that cat 😉 You can google PostgreSQL date format for instance. Or if you need it displayed in JavaScript you can just pass the date returned to another little library of mine 😉 https://github.com/porsager/datie
Is there a way to change the default date serialization behavior of the client?
I can see in https://github.com/porsager/postgres/blob/master/src/types.js#L31 that dates are serialized as follows:
serialize: x => (x instanceof Date ? x : new Date(x)).toISOString()
I'd like to change this to :
serialize: x => (x instanceof Date ? x : new Date(x)).getTime()
Is there a way to achieve this?
I'm not sure but does this work @aakashns https://github.com/porsager/postgres/issues/161#issuecomment-801031062 ?
Consider the following query.
This return the JSON result like this.
I would like to return this
createdOn
result inmm/dd/yyyy
format.