md-date
v1.0.2
Published
get date from markdown article
Downloads
4
Maintainers
Readme
md-date
get date from markdown article
Install
npm install --save md-date
Usage
import getDate from 'md-date';
const input = `
# title
21 asd qwe
22 *Dec* 2016
23 December 2016
24 Décembre 2016`;
getDate('DD MMM YYYY', 'en', input).text; // 21 Dec 2016
getDate('DD MMM YYYY', 'en', input).html; // 22 <em>Dec</em> 2016
getDate('DD MMM YYYY', 'en', input).unix; // 1482364800
getDate('DD MMMM YYYY', 'en', input).text; // 23 December 2016
getDate('DD MMMM YYYY', 'fr', input).text; // 24 Décembre 2016
getDate('DD MMMM YYYY', 'en', input).moment; // moment instance
getDate('DD MMMM YYYY', 'en', input).node; // MDAST node, see remark 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
- md-article - extract data from your markdown article
- md-content - get content from markdown article
- md-tags - get tags from markdown article
- md-title - get title from markdown article
License
MIT © Aleksandr Filatov