Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-date-parse

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-date-parse

fast date parsing

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

fast-date-parse

Build Status Coverage Status NPM version JavaScript Style Guide

Performant date parsing.

Installation

npm i fast-date-parse

Example

const DateParser = require('fast-date-parse')

const parser = new DateParser('YYYY-MM-DD')

parser.parse('2018-09-02')

Tokens

Supported tokens:

TokenExampleDescription
YYYY2018Year
MM01..12Month
HH00..23Hours (24 hour time)
DD01..31Day of month
mm00..59Minutes
ss00..59Seconds
SSS000..999Milliseconds

API

DateParser(datePattern)

Creates a new parser.

The parser ignores all non-token characters.

DateParser#parse(dateString)

Parses the dateString and returns a date object.

Benchmark

$ node benchmark/benchmark.js
moment x 73,592 ops/sec ±1.75% (90 runs sampled)
fast-date-parse x 1,727,745 ops/sec ±1.09% (87 runs sampled)
fecha x 98,347 ops/sec ±1.74% (84 runs sampled)
Fastest is fast-date-parse

License

MIT

Keywords

FAQs

Package last updated on 18 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc