mjp

moment-json-parser

Date parsing extensions for the JavaScript JSON parser to provide moment objects directly from JSON.parse()

Showing:

Popularity

Downloads/wk

288

GitHub Stars

4

Maintenance

Last Commit

6yrs ago

Contributors

4

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Moment.js JSON Parser

Date parsing extensions for the JavaScript JSON parser to provide moment objects from JSON.parse()####

This small JavaScript library provides for automatically parsing JSON date strings to moment objects as part of regular JSON parsing. You can parse either individual date values or complex objects containing dates and have them automatically turned into moments, unlike the default JSON parser behavior of parsing to ISO 8601 date strings.

You can either manually run the date parsing or replace the JSON parser for the global scope to force all JSON operations to parse dates automatically, including those by other frameworks such as jQuery, angularJS etc.

This library is a fork or original which works with moment.js rather than with raw date.

Original article

Usage

Install

npm i moment-json-parser -S
#or with JSPM
jspm install moment-json-parser

Use as a function which you just require

var jsonParser = require('../moment-json-parser');

or override the default JSON.parse

require('../moment-json-parser').overrideDefault();
// JSON.parse gives you moments !!!

you can also revert back to default JSON.parse

require('../moment-json-parser').overrideDefault(false);
// JSON.parse gives you only strings :-(

This

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial