https://github.com/giacomorebonato/parse-json-with-dates
A small utility that parses JSON and converts date fields to Date type.
https://github.com/giacomorebonato/parse-json-with-dates
Last synced: 6 days ago
JSON representation
A small utility that parses JSON and converts date fields to Date type.
- Host: GitHub
- URL: https://github.com/giacomorebonato/parse-json-with-dates
- Owner: giacomorebonato
- License: mit
- Created: 2021-01-04T17:05:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-10T17:52:43.000Z (over 4 years ago)
- Last Synced: 2024-11-12T22:17:36.885Z (8 months ago)
- Language: TypeScript
- Size: 270 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# parse-json-with-dates
| Statements | Branches | Functions | Lines |
| ------------------------- | ----------------------- | ------------------------ | -------------------- |
|  |  |  |  |A small utility that parses JSON and converts date fields to Date type.
[Documentation](./docs/modules.md)
**Example**
```js
import { parseJsonWithDates } from 'parse-json-with-dates'const parsed = parseJsonWithDates(
JSON.stringify({ 'date-field': new Date() }),
['date-field']
)parsed.a.toISOString() // it's a date!
``````typescript
import { parseJsonWithDates } from 'parse-json-with-dates'type MyDate = {
a: Date
}const parsed = parseJsonWithDates(
JSON.stringify({ 'date-field': new Date() }),
['date-field']
)parsed.a.toISOString() // it's a date!
```