A focused parser that converts PostgreSQL date/time output strings into JavaScript Date objects, preserving precision and matching Postgres behavior. Version 2.1.0 supports Node >=12 and includes TypeScript types. It is maintained as a patch-level library with no minor releases planned, releasing fixes only. Unlike heavier database clients, this is a minimal single-purpose tool for accurate date parsing.
npm install postgres-dateVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing various PostgreSQL date strings including timezone offsets and infinity values.
Check for null before using the result if your data may contain infinity dates.
Manually handle BC dates by adjusting the year: parse('0001-01-01 BC') will not give correct year.Ensure your Postgres session timezone is set to UTC or verify the offset before parsing.
Use `import parse from 'postgres-date'` or `const parse = require('postgres-date')`.Run `npm install postgres-date` and ensure tsconfig.json includes `node_modules` in moduleResolution.
Check input dates and handle extremely large years manually.
No dependency data recorded yet.