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

get-date-format

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-date-format

Module that tries to get the date format out of sample of dates

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45
decreased by-27.42%
Maintainers
1
Weekly downloads
 
Created
Source

get-date-format

CircleCI

Module that extracts date format out of sample of dates

Intro

If you have sources of the data with inconsistent date formats, usually it is required to figure out date format of each data set before doing any analysis with the data. This module is trying to solve that issue by extracting date format from the array of the dates. The more elements are in the array, the more accurate is the prediction. 13 consecutive days are enough for accurate prediction of the date format.

This module can detect all official date formats of all the countries represented here https://en.wikipedia.org/wiki/Date_format_by_country

Examples

Example usage:

const getDateFormat = require('get-date-format')
// or
// import getDateFormat from 'get-date-format'

const sampleOfDates = ['2017-01-01', '2017-03-11', '2017-03-13', '2017-12-12']
const dateFormat = getDateFormat(sampleOfDates)
console.log(dateFormat)
// YYYY-MM-DD

If date format can't be extracted, function is returning null

const getDateFormat = require('get-date-format')
// or
// import getDateFormat from 'get-date-format'

const sampleOfDates = ['some text', 'more text']
const dateFormat = getDateFormat(sampleOfDates)
console.log(dateFormat)
// null

Optimizing for speed

TODO

Keywords

FAQs

Package last updated on 22 Dec 2017

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