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

diff-ymd-package

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diff-ymd-package - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

10

CHANGELOG.md

@@ -302,4 +302,8 @@ ## Changelog

- README.md updated: Added consistent formating and recommended for best practices.
### [v3.1.1]
#### Fixed
- Updated codebase for updating diff to best practiced
- fixed some other issues and configured files for v3.1.1
### [Next Release] - Collecting issues and new features for next release

@@ -309,4 +313,4 @@

- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v3.1.0...HEAD)
- [v3.1.0](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v3.1.0)
- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v3.1.1...HEAD)
- [v3.1.1](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v3.1.1)
- [Next Release](https://github.com/farhan7reza7/diff-ymd-package/milestone/2)

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.DatesYMD=e():t.DatesYMD=e()}(this,(()=>{return t={609:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:String(r)}var i=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.firstDate=e,this.secondDate=r,this.handleEmpty=function(){var t,e;return""===this.firstDate&&""===this.secondDate?(t=new Date,e=new Date):""===this.firstDate?(t=new Date,e=new Date(this.secondDate)):""===this.secondDate?(t=new Date(this.firstDate),e=new Date):(t=new Date(this.firstDate),e=new Date(this.secondDate)),[t,e]},this.swapDates=function(t,e){if(t.getTime()<e.getTime()){var r=t;t=e,e=r}return[t,e]},this.initDiff=function(){var t,e,r,n;return t=(r=this.handleEmpty())[0],e=r[1],(n=this.swapDates(t,e))&&(t=n[0],e=n[1]),[t,e]}}var e,n;return e=t,(n=[{key:"diffArray",value:function(){var t,e,r,n,i,o,f,a,u,s,c,y,l;return i=(f=this.initDiff())[0],a=(o=f[1]).getFullYear(),u=i.getFullYear(),s=o.getMonth()+1,c=i.getMonth()+1,y=o.getDate(),l=i.getDate(),c>=s&&l>=y?(t=u-a,e=c-s,r=l-y):c<s&&l>=y?(r=l-y,e=c+12-s,t=u-1-a):c>s&&l<y?(e=c-s-1,t=u-a,r=2==(n=c-1)?u%4==0?l>29?l:29-y+l:l>28?l:28-y+l:4===n||6===n||8===n||11===n?l>30?l:30-y+l:31-y+l):c<=s&&l<y&&(e=c+11-s,t=u-1-a,r=2==(n=c-1)?u%4==0?l>29?l:29-y+l:l>28?l:28-y+l:4===n||6===n||8===n||11===n?l>30?l:30-y+l:31-y+l),[t,e,r,t+"Y "+e+"M "+r+"D"]}},{key:"formattedYMD",value:function(){return this.diffArray()[3]}},{key:"customizeFormat",value:function(t,e,r,n){return this.diffArray()[0]+t+n+this.diffArray()[1]+e+n+this.diffArray()[2]+r}},{key:"diffInMonths",value:function(){var t;return 12*(t=this.diffArray())[0]+t[1]}},{key:"diffInWeeks",value:function(){var t,e,r;return e=(t=this.initDiff())[0],r=t[1],Math.floor((e.getTime()-r.getTime())/6048e5)}},{key:"diffInDays",value:function(){var t,e,r;return e=(t=this.initDiff())[0],r=t[1],Math.floor((e.getTime()-r.getTime())/864e5)}},{key:"diffInYears",value:function(){return this.diffArray()[0]}},{key:"diffInHours",value:function(){return 24*this.diffInDays()}},{key:"diffInMinutes",value:function(){return 60*this.diffInHours()}},{key:"diffInSeconds",value:function(){return 60*this.diffInMinutes()}}])&&r(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.exports=i},919:(t,e,r)=>{var n=r(609);t.exports=function(t,e){return new n(t,e)}},954:(t,e,r)=>{var n=r(609),i=r(919);Date.prototype.diff=function(t){return i(this,t)},t.exports=n,t.exports.diffDates=i}},e={},function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}(954);var t,e}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.DatesYMD=e():t.DatesYMD=e()}(this,(()=>{return t={609:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:String(r)}var i=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.firstDate=e,this.secondDate=r,this.handleEmpty=function(){var t,e;return""===this.firstDate&&""===this.secondDate?(t=new Date,e=new Date):""===this.firstDate?(t=new Date,e=new Date(this.secondDate)):""===this.secondDate?(t=new Date(this.firstDate),e=new Date):(t=new Date(this.firstDate),e=new Date(this.secondDate)),[t,e]},this.swapDates=function(t,e){if(t.getTime()<e.getTime()){var r=t;t=e,e=r}return[t,e]},this.initDiff=function(){var t,e,r,n;return t=(r=this.handleEmpty())[0],e=r[1],(n=this.swapDates(t,e))&&(t=n[0],e=n[1]),[t,e]}}var e,n;return e=t,(n=[{key:"diffArray",value:function(){var t,e,r,n,i,o,f,a,u,s,c,y,l;return i=(f=this.initDiff())[0],a=(o=f[1]).getFullYear(),u=i.getFullYear(),s=o.getMonth()+1,c=i.getMonth()+1,y=o.getDate(),l=i.getDate(),c>=s&&l>=y?(t=u-a,e=c-s,r=l-y):c<s&&l>=y?(r=l-y,e=c+12-s,t=u-1-a):c>s&&l<y?(e=c-s-1,t=u-a,r=2==(n=c-1)?u%4==0?l>29?l:29-y+l:l>28?l:28-y+l:4===n||6===n||8===n||11===n?l>30?l:30-y+l:31-y+l):c<=s&&l<y&&(e=c+11-s,t=u-1-a,r=2==(n=c-1)?u%4==0?l>29?l:29-y+l:l>28?l:28-y+l:4===n||6===n||8===n||11===n?l>30?l:30-y+l:31-y+l),[t,e,r,t+"Y "+e+"M "+r+"D"]}},{key:"formattedYMD",value:function(){return this.diffArray()[3]}},{key:"customizeFormat",value:function(t,e,r,n){return this.diffArray()[0]+t+n+this.diffArray()[1]+e+n+this.diffArray()[2]+r}},{key:"diffInMonths",value:function(){var t;return 12*(t=this.diffArray())[0]+t[1]}},{key:"diffInWeeks",value:function(){var t,e,r;return e=(t=this.initDiff())[0],r=t[1],Math.floor((e.getTime()-r.getTime())/6048e5)}},{key:"diffInDays",value:function(){var t,e,r;return e=(t=this.initDiff())[0],r=t[1],Math.floor((e.getTime()-r.getTime())/864e5)}},{key:"diffInYears",value:function(){return this.diffArray()[0]}},{key:"diffInHours",value:function(){return 24*this.diffInDays()}},{key:"diffInMinutes",value:function(){return 60*this.diffInHours()}},{key:"diffInSeconds",value:function(){return 60*this.diffInMinutes()}}])&&r(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.exports=i},919:(t,e,r)=>{var n=r(609);t.exports=function(t,e){return new n(t,e)}},954:(t,e,r)=>{var n=r(609),i=r(919);Date.prototype.diff||(Date.prototype.diff=function(t){return i(this,t)}),t.exports=n,t.exports.diffDates=i}},e={},function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}(954);var t,e}));
{
"name": "diff-ymd-package",
"version": "3.1.0",
"version": "3.1.1",
"description": "A javascript library for calculating the difference between two dates in formatted ways like (aY bM cD)(aYears bMonths cDays) or customized desired formats like aY-bM-cD or aYears-bMonths-cDays or kDays or mWeeks or nMonths etc.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -47,5 +47,7 @@ /**

*/
Date.prototype.diff = function (date) {
return diffDates(this, date);
};
if (!Date.prototype.diff) {
Date.prototype.diff = function (date) {
return diffDates(this, date);
};
}

@@ -52,0 +54,0 @@ // Export the DatesYMD class and equivalent function diffDates for usages in other modules

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