# postgres-date

> Postgres date column parser

Latest version **2.1.0** (published 2021-12-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install postgres-date
pnpm add postgres-date
yarn add postgres-date
bun add postgres-date
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2021-12-08 |
| First published | 2015-06-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | postgres, date, parser |

## Links

- npm: https://www.npmjs.com/package/postgres-date
- Repository: https://github.com/bendrucker/postgres-date
- Homepage: https://github.com/bendrucker/postgres-date#readme
- Issues: https://github.com/bendrucker/postgres-date/issues
- npm.io page: https://npm.io/package/postgres-date

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2021-12-08
- 2.0.1 — 2021-03-09
- 2.0.0 — 2020-10-29
- 1.0.7 — 2020-08-28
- 1.0.6 — 2020-08-05
- 1.0.5 — 2020-04-13
- 1.0.4 — 2019-04-03
- 1.0.3 — 2016-07-06
- 1.0.2 — 2016-05-19
- 1.0.1 — 2015-12-31
- 1.0.0 — 2015-06-13
- 0.0.0 — 2015-06-13

## README

# postgres-date [![tests](https://github.com/bendrucker/postgres-date/workflows/tests/badge.svg)](https://github.com/bendrucker/postgres-date/actions?query=workflow%3Atests)

> Postgres date output parser

This package parses [date/time outputs](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT) from Postgres into Javascript `Date` objects. Its goal is to match Postgres behavior and preserve data accuracy.

If you find a case where a valid Postgres output results in incorrect parsing (including loss of precision), please [create a pull request](https://github.com/bendrucker/postgres-date/compare) and provide a failing test.

**Supported Postgres Versions:** `>= 9.6`

All prior versions of Postgres are likely compatible but not officially supported.

## Install

```
npm install --save postgres-date
```

## Usage

```js
const parse = require('postgres-date')
parse('2011-01-23 22:15:51Z')
// => 2011-01-23T22:15:51.000Z
```

## API

#### `parse(isoDate)` -> `date`

##### isoDate

*Required*  
Type: `string`

A date string from Postgres.

## Releases

The following semantic versioning increments will be used for changes:

* **Major**: Removal of support for Node.js versions or Postgres versions (not expected)
* **Minor**: Unused, since Postgres returns dates in standard ISO 8601 format
* **Patch**: Any fix for parsing behavior

## License

MIT © [Ben Drucker](http://bendrucker.me)

---
_Source: https://npm.io/package/postgres-date · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
