Skip to content

Commit

Permalink
Update index.js to correctly integrate diff as Date mathod
Browse files Browse the repository at this point in the history
Update index.js to correctly integrate diff  as Date mathod
  • Loading branch information
farhan7reza7 authored Mar 5, 2024
1 parent ad391af commit d0839f3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,10 @@ const diffDates = require('./diff-dates');
* @param {string} date (type- String but Number for epoch, and Object for dateObject) - The date to be differed, in the format 'yyyy-mm-dd' or 'yyyy/mm/dd' or yyyy.mm.dd or dateString or dateObject or Timestamp(epoch).
* @returns {DatesYMD} An object containing methods for date difference calculations.
*/
export function config(Date) {
Date.prototype.diff = function (date) {
return diffDates(this, date);
}
};

// Export the DatesYMD class and equivalent function diffDates for usages in other modules
//module.exports = DatesYMD; // default export for class
module.exports= config; // named export for integrating to Date
module.exports = DatesYMD; // default export for class
module.exports.diffDates = diffDates; // named export for equivalent function
//module.exports.config = config; // named export for integrating to Date

0 comments on commit d0839f3

Please sign in to comment.