https://github.com/featurist/dateism
https://github.com/featurist/dateism
dates javascript
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/featurist/dateism
- Owner: featurist
- Created: 2017-03-09T13:22:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-06-26T16:38:24.000Z (almost 8 years ago)
- Last Synced: 2025-01-20T11:21:36.125Z (over 1 year ago)
- Topics: dates, javascript
- Language: JavaScript
- Size: 14.6 KB
- Stars: 1
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# dateism [](https://www.npmjs.com/package/dateism) [](https://www.npmjs.com/package/dateism) [](https://travis-ci.org/featurist/dateism)
For lack of a better name...
## Premise
You are in a situation where you need to get lots of dates relative to a point in time and in the same format.
## Usage
`npm install dateism` or `yarn install dateism`
dateism must be initialised with a format to use and optionally a seed date. If you don't supply a seed date then the date right now will be used.
### Example
```js
const dateism = require('dateism')
const dates = dateism({format: 'DD MMM YYYY', seed: new Date('1947-02-15')})
dates.addDays(-5) // -> '10 Feb 1947'
dates.threeDaysAgo() // -> '12 Feb 1947'
dates.twoDaysAgo() // -> '13 Feb 1947'
dates.today() // -> '15 Feb 1947'
dates.tomorrow() // -> '16 Feb 1947'
dates.addDays(5) // -> '20 Feb 1947'
```
## We're Hiring!
Featurist provides full stack, feature driven development teams. Want to join us? Check out [our career opportunities](https://www.featurist.co.uk/careers/).