https://github.com/danielearwicker/json-date-parser
Minimal function suitable for passing to JSON.parse to revive common date-time strings into Date objects
https://github.com/danielearwicker/json-date-parser
Last synced: about 1 year ago
JSON representation
Minimal function suitable for passing to JSON.parse to revive common date-time strings into Date objects
- Host: GitHub
- URL: https://github.com/danielearwicker/json-date-parser
- Owner: danielearwicker
- License: mit
- Created: 2017-02-03T13:57:29.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-03T18:55:15.000Z (over 9 years ago)
- Last Synced: 2025-03-30T03:51:07.744Z (about 1 year ago)
- Language: TypeScript
- Size: 3.91 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# json-date-parser
Minimal function suitable for passing to JSON.parse to revive common date-time strings (including ISO and those weird .NET ones) into Date objects.
Implementation is cribbed straight from: [json.date-extensions](https://github.com/RickStrahl/json.date-extensions).
Differences:
* Instead of polluting the core `JSON` object, it defines a completely separate function.
* TypeScript type information is included.
## Installation
npm install --save json-date-parser
## Usage
```ts
import { jsonDateParser } from "json-date-parser"
// Call standard JSON parser but use jsonDateParser as a "reviver"
var parsedStuff = JSON.parse(stringOfJson, jsonDateParser);
```