Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "date-diff", | ||
"main": "date-diff.js", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/melvinsembrano/date-diff", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -79,4 +79,8 @@ | ||
window.DateDiff = DateDiff; | ||
this.DateDiff = DateDiff; | ||
if (typeof module !== "undefined") { | ||
module.exports = DateDiff; | ||
} | ||
}).call(this); |
/*! | ||
date-diff 0.1.1 | ||
date-diff 0.1.2 | ||
Description: DateDiff is a minimalized Javascript date arithmetic extension. | ||
Author: Melvin Sembrano <melvinsembrano@gmail.com> (https://github.com/melvinsembrano/date-diff) | ||
*/ | ||
(function(){var a,b;a=function(a,b){this.date1=a,this.date2=b,this.difference=Math.floor(a-b)},b={days:864e5,hours:36e5,minutes:6e4,seconds:1e3},a.prototype.weeks=function(){return this._roundIt(this.days()/7)},a.prototype.days=function(){return this._roundIt(this.difference/b.days)},a.prototype.hours=function(){return this._roundIt(this.difference/b.hours)},a.prototype.minutes=function(){return this._roundIt(this.difference/b.minutes)},a.prototype.seconds=function(){return this._roundIt(this.difference/b.seconds)},a.prototype.months=function(){var a,b;return b=12*(this.date1.getFullYear()-this.date2.getFullYear()),b+=this.date1.getMonth()-this.date2.getMonth(),a=this.endOfMonth(this.date2).getDate(),b+=this.date1.getDate()/a-this.date2.getDate()/a,this._roundIt(b)},a.prototype.years=function(){var a,b;return b=this.date1.getFullYear()-this.date2.getFullYear(),b+=(this.date1.getMonth()-this.date2.getMonth())/12,a=this.endOfMonth(this.date2).getDate(),b+=this.date1.getDate()/a-this.date2.getDate()/a,this._roundIt(b)},a.prototype.endOfMonth=function(a){return new Date(a.getFullYear(),a.getMonth()+1,0)},a.prototype.endOfYear=function(a){return new Date(a.getFullYear()+1,0,0)},a.prototype._roundIt=function(a){return parseFloat(a.toFixed(1))},Date.diff=function(b,c){return new a(b,c)},window.DateDiff=a}).call(this); | ||
(function(){var a,b;a=function(a,b){this.date1=a,this.date2=b,this.difference=Math.floor(a-b)},b={days:864e5,hours:36e5,minutes:6e4,seconds:1e3},a.prototype.weeks=function(){return this._roundIt(this.days()/7)},a.prototype.days=function(){return this._roundIt(this.difference/b.days)},a.prototype.hours=function(){return this._roundIt(this.difference/b.hours)},a.prototype.minutes=function(){return this._roundIt(this.difference/b.minutes)},a.prototype.seconds=function(){return this._roundIt(this.difference/b.seconds)},a.prototype.months=function(){var a,b;return b=12*(this.date1.getFullYear()-this.date2.getFullYear()),b+=this.date1.getMonth()-this.date2.getMonth(),a=this.endOfMonth(this.date2).getDate(),b+=this.date1.getDate()/a-this.date2.getDate()/a,this._roundIt(b)},a.prototype.years=function(){var a,b;return b=this.date1.getFullYear()-this.date2.getFullYear(),b+=(this.date1.getMonth()-this.date2.getMonth())/12,a=this.endOfMonth(this.date2).getDate(),b+=this.date1.getDate()/a-this.date2.getDate()/a,this._roundIt(b)},a.prototype.endOfMonth=function(a){return new Date(a.getFullYear(),a.getMonth()+1,0)},a.prototype.endOfYear=function(a){return new Date(a.getFullYear()+1,0,0)},a.prototype._roundIt=function(a){return parseFloat(a.toFixed(1))},Date.diff=function(b,c){return new a(b,c)},this.DateDiff=a,"undefined"!=typeof module&&(module.exports=a)}).call(this); |
@@ -5,3 +5,3 @@ { | ||
"description": "DateDiff is a minimalized Javascript date arithmetic extension.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "DateDiff", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18879
243