main
|
Last change
on this file was 62b2964, checked in by Klimentina Efremova <klimentina08642@…>, 2 weeks ago |
|
Project Handcraft Marketplace
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Rev | Line | |
|---|
| [62b2964] | 1 | # postgres-date [](https://travis-ci.org/bendrucker/postgres-date) [](https://greenkeeper.io/)
|
|---|
| 2 |
|
|---|
| 3 | > Postgres date output parser
|
|---|
| 4 |
|
|---|
| 5 | 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.
|
|---|
| 6 |
|
|---|
| 7 | 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.
|
|---|
| 8 |
|
|---|
| 9 | **Supported Postgres Versions:** `>= 9.6`
|
|---|
| 10 |
|
|---|
| 11 | All prior versions of Postgres are likely compatible but not officially supported.
|
|---|
| 12 |
|
|---|
| 13 | ## Install
|
|---|
| 14 |
|
|---|
| 15 | ```
|
|---|
| 16 | $ npm install --save postgres-date
|
|---|
| 17 | ```
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | ## Usage
|
|---|
| 21 |
|
|---|
| 22 | ```js
|
|---|
| 23 | var parse = require('postgres-date')
|
|---|
| 24 | parse('2011-01-23 22:15:51Z')
|
|---|
| 25 | // => 2011-01-23T22:15:51.000Z
|
|---|
| 26 | ```
|
|---|
| 27 |
|
|---|
| 28 | ## API
|
|---|
| 29 |
|
|---|
| 30 | #### `parse(isoDate)` -> `date`
|
|---|
| 31 |
|
|---|
| 32 | ##### isoDate
|
|---|
| 33 |
|
|---|
| 34 | *Required*
|
|---|
| 35 | Type: `string`
|
|---|
| 36 |
|
|---|
| 37 | A date string from Postgres.
|
|---|
| 38 |
|
|---|
| 39 | ## Releases
|
|---|
| 40 |
|
|---|
| 41 | The following semantic versioning increments will be used for changes:
|
|---|
| 42 |
|
|---|
| 43 | * **Major**: Removal of support for Node.js versions or Postgres versions (not expected)
|
|---|
| 44 | * **Minor**: Unused, since Postgres returns dates in standard ISO 8601 format
|
|---|
| 45 | * **Patch**: Any fix for parsing behavior
|
|---|
| 46 |
|
|---|
| 47 | ## License
|
|---|
| 48 |
|
|---|
| 49 | MIT © [Ben Drucker](http://bendrucker.me)
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.