0.2.1 • Published 6 years ago

get-date-format v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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

0.2.1

6 years ago

0.2.0

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago