Registry / database / postgres-date-utc

postgres-date-utc

JSON →
library1.0.3jsnpmunverified

Postgres UTC date column parser. Version 1.0.3 parses Postgres-formatted date strings (with timezone 'Z') and returns ISO 8601 UTC strings. Released under MIT, targets Node >=0.10.0. Minimal footprint, zero dependencies. Counterpart to libraries like 'postgres-date' but enforces UTC output. No longer maintained; last update was 8+ years ago. Use for legacy projects only.

npm install postgres-date-utc
INSTALL
IMPORT
SIG · POSTGRES-DATE-UTC
P
postgres-date-utc
databasejavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
var parse = require('postgres-date')
import parse from 'postgres-date'
The package does not export ESM; use CommonJS require.

Demonstrates parsing Postgres date strings with timezone 'Z', offset, and without timezone, all returning UTC.

var parse = require('postgres-date'); console.log(parse('2011-01-23 22:15:51Z')); // => 2011-01-23T22:15:51.000Z var parse = require('postgres-date'); console.log(parse('2011-01-23 22:15:51-05')); // => 2011-01-23T22:15:51.000Z (ignores offset, returns UTC) var parse = require('postgres-date'); console.log(parse('2011-01-23 22:15:51')); // => 2011-01-23T22:15:51.000Z (assumes UTC)
Debug
Known issues
deprecatedPackage is effectively unmaintained; no updates since 2014.
fix
Consider using 'postgres-date' with manual offset handling, or use the built-in Date parser with caution.
affects: >=1.0.0
breakingInput strings without explicit timezone are treated as UTC, not local time. This may differ from Postgres behavior in some contexts.
fix
Ensure date strings include 'Z' or a numeric offset if you need explicit timezone handling.
affects: >=1.0.0
gotchaThe package ignores any timezone offset in the input string and always outputs UTC.
fix
If you need to preserve the offset, use a library that supports timezone offsets, e.g., 'postgres-date' or 'luxon'.
affects: >=1.0.0
gotchaThe install command in README is wrong: '$ npm install --save postgres-date' should be '$ npm install --save postgres-date-utc'.
fix
Install the correct package: npm install postgres-date-utc
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'postgres-date'
Install command in README is incorrect (lists 'postgres-date' instead of 'postgres-date-utc', but that's a different package).
fix
npm install postgres-date-utc
SyntaxError: Unexpected token 'export' (or similar when using ES modules)
Package uses CommonJS (module.exports) but user tries to import with ES import syntax.
fix
Use require('postgres-date') instead of import.
The date string '2011-01-23 22:15:51+02' gives '2011-01-23T22:15:51.000Z' but I expected '2011-01-23T20:15:51.000Z'.
Package ignores the timezone offset and always outputs the input time as UTC.
fix
Pre-process the date string to convert the offset before parsing, or use a different library that handles offsets correctly.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
postgres-date-utc — npm install postgres-date-utc · libregistry