Description
With 1.0 on the horizon due to the wonderful new treatment of numeric types (#271) I'd like to ask about how and why node-postgres treats dates as javascript objects. It may be I am simply doing things wrong or missing a setting.
Here is my use case:
- Accept JSON data into an API w/ISO dates, or date times.
- Save the date/datetime/time into appropriate Postgres typed field.
- At a future point in time, retrieve the date/datetime/time out of the system and return it over JSON.
The first two steps function acceptably, however the fetching of a row returns a javascript date object. This means that if I'm storing only the date, I need to have metadata surrounding the column type, and utilize it to transform the javascript date back into a string.
This seems silly considering it's then being transformed from string -> javascript date -> string.
So, the questions:
- Is there something I'm missing that allow me to treat dates solely as strings as things stand right now?
- If no to above, would you be willing to accept a pull request which allows this functionality to exist, perhaps through a
pg.defaults.parseDate = false
parameter, which defaults to true?
If code must be written, I could create a pull request before Friday to hopefully sneak it into 1.0.
Please advise (and thanks for the great library!)