1.0.1 • Published 10 years ago

get-md-date v1.0.1

Weekly downloads
37
License
MIT
Repository
github
Last release
10 years ago

get-md-date

NPM version Build Status Coveralls Status Dependency Status

get date from markdown article

Install

npm install --save get-md-date

Usage

import getDate from 'get-md-date';

const input = `
# title

21 asd qwe

22 *Dec* 2015

23 December 2015

24 Décembre 2015`;

getDate('DD MMM YYYY',  'en', input).text;   // 21 Dec 2015
getDate('DD MMM YYYY',  'en', input).html;   // 22 <em>Dec</em> 2015
getDate('DD MMM YYYY',  'en', input).unix;   // 1450645200000
getDate('DD MMMM YYYY', 'en', input).text;   // 23 December 2015
getDate('DD MMMM YYYY', 'fr', input).text;   // 24 Décembre 2015
getDate('DD MMMM YYYY', 'en', input).moment; // moment instance
getDate('DD MMMM YYYY', 'en', input).node;   // AST node, see commonmark API
getDate('DD MMMM YYYY', 'en', '');           // undefined ¯\_(ツ)_/¯

API

getDate(format, locale, input)

format

Required
Type: String

Momentjs format for date, e.g. DD MMMM YYYY.

locale

Required
Type: String

One of 83 available in momentjs locales, e.g. en or fr.

input

Required
Type: String

Markdown string.

Related

License

MIT © Vladimir Starkov

1.0.1

10 years ago

1.0.0

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago