https://github.com/martinheidegger/fs-date-parser
Simple node library to parse the date from a file-system path. (used for static site generators)
https://github.com/martinheidegger/fs-date-parser
Last synced: 3 months ago
JSON representation
Simple node library to parse the date from a file-system path. (used for static site generators)
- Host: GitHub
- URL: https://github.com/martinheidegger/fs-date-parser
- Owner: martinheidegger
- Created: 2015-06-17T05:13:45.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-11T15:26:39.000Z (over 9 years ago)
- Last Synced: 2025-03-05T01:46:14.969Z (4 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
[](https://travis-ci.org/martinheidegger/fs-date-parser)[](https://coveralls.io/github/martinheidegger/fs-date-parser?branch=master)
[](http://standardjs.com/)# fs-date-parser
For static site blogs or pages you might want to setup the path to contain a date for sorting and publication. This little parser is fairly flexible and aimed exactly at this purpose.
## Usage
Install the date parser using:
`$ npm i fs-date-parser --save`
Then you can use it just like
```JavaScript
var parse = require('fs-date-parser');parse('2015/06/09-hello.md'); // {date: /*Tue Jun 09 2015 00:00:00 GMT+0900 (JST)*/, rest: 'hello.md'}
parse('2015-06-09-hello.md'); // {date: /*Tue Jun 09 2015 00:00:00 GMT+0900 (JST)*/, rest: 'hello.md'}parse('hello.md') // {date:}
```(writing this from a japanese time-zone)