functional-date-time-helpers

1.3.0 • Public • Published

functional-date-time-helpers

Status: npm version npm downloads Codeship

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.

Usage (node)

Install through npm

npm install --save functional-date-time-helpers

Require the library and use the provided functions

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

<script src="/path/to/dist/functional-date-time-helpers.browser.js" type="text/javascript"></script>

Use the provided functions

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 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.

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

Package Sidebar

Install

npm i functional-date-time-helpers

Weekly Downloads

2

Version

1.3.0

License

MIT

Last publish

Collaborators

  • webmatze