From 91dc41e96dccd7f4bf8fb8b820054c9814589a31 Mon Sep 17 00:00:00 2001 From: Farhan Reza Date: Tue, 5 Mar 2024 22:38:32 +0530 Subject: [PATCH] integrate diff following recommended practices as the method of Date Object on importing diff-ymd-package --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 086209bc..3004b738 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1 +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=s&&l>=y?(t=u-a,e=c-s,r=l-y):c=y?(r=l-y,e=c+12-s,t=u-1-a):c>s&&l29?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&&l29?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})); \ No newline at end of file +!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=s&&l>=y?(t=u-a,e=c-s,r=l-y):c=y?(r=l-y,e=c+12-s,t=u-1-a):c>s&&l29?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&&l29?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})); \ No newline at end of file