https://github.com/webmatze/functional-date-time-helpers
pure functional date time helpers
https://github.com/webmatze/functional-date-time-helpers
Last synced: 3 days ago
JSON representation
pure functional date time helpers
- Host: GitHub
- URL: https://github.com/webmatze/functional-date-time-helpers
- Owner: webmatze
- Created: 2016-04-18T11:39:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-29T09:30:09.000Z (about 9 years ago)
- Last Synced: 2025-06-26T20:11:11.855Z (18 days ago)
- Language: JavaScript
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# functional-date-time-helpers
Status:
[](https://www.npmjs.com/package/functional-date-time-helpers)
[](http://npm-stat.com/charts.html?package=functional-date-time-helpers&from=2016-04-01)
[](https://codeship.com/projects/147603)functional-date-time-helpers are a few pure functions to manipulate date and time in your JavaScript projects. Think of it as a lightweight alternative to the date manipulation methods of [Moment.js](https://github.com/moment/moment/).
## Usage (node)
Install through npm
````
npm install --save functional-date-time-helpers
````Require the library and use the provided functions
````javascript
var fdth = require('functional-date-time-helpers')
var threeMinutesInMilliseconds = fdth.minutes(3)
var now = new Date();
var treeMinutesAgo = fdth.subTime(threeMinutesInMilliseconds, now);
````## Usage (browser)
Install using bower
````
bower install --save functional-date-time-helpers
````Include it to your html page
````
````
Use the provided functions
````javascript
var fdth = window.functionalDateTimeHelpers;
var now = new Date();
var inThreeDays = fdth.addTime(fdth.days(3), now);
````## Performance
One of the goals of this library is to provide fast functions for date and time manipulation.
While the popular [Moment.js](https://github.com/moment/moment/) is a great library with lots of functionality it has also some performance problems when manipulating date and time.
That is why I created functional-date-time-helpers with optimized functions that can give you a significant performance boost compared to the equivalent methods of [Moment.js](https://github.com/moment/moment/).
I also included a benchmark suite that you can run to check the performance of each function.
To run the benchmark simply call this command:
````
npm run perf
````