Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

date-diff

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-diff

DateDiff is a minimalized Javascript date arithmetic extension.

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3K
decreased by-4.29%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

DateDiff

DateDiff is a minimalized javascript date arithmetic extension

Installation

Node.js npm install date-diff

Bower bower install date-diff

Download the latest

Usage

Node.js

var DateDiff = require('date-diff');

In Browser

<script src="date-diff.js"></script>

Quickstart usage:

var date1 = new Date(2015, 11, 1); // 2015-12-1
var date2 = new Date(2014, 0, 1); // 2014-01-1

var diff = new DateDiff(date1, date2);

diff.years(); // ===> 1.9
diff.months(); // ===> 23
diff.days(); // ===> 699
diff.weeks(); // ===> 99.9
diff.hours(); // ===> 16776
diff.minutes(); // ===> 1006560
diff.seconds(); // ===> 60393600

it also add a date helper:

Date.diff(date1, date2).years();
Date.diff(date1, date2).months();
Contributing to DateDiff
  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Gruntfile, package.json, travis.yml, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
  • Checkout Gruntfile.coffee, there are few grunt tasks that are very helpful during development.

Copyright (c) 2015 Melvin Sembrano. See LICENSE for further details

Keywords

FAQs

Package last updated on 06 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc