1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-20 04:39:34 +05:30
Files
neosubhamoy-portfolio/htdocs/assets/js/utility-functions.js

11 lines
373 B
JavaScript

//---JS utility functions
// function to calculate the year difference between the given date and the current date
function calculateYearDiff(date) {
let givenDate = new Date(date);
let currentDate = new Date();
let timeDiff = currentDate.getTime() - givenDate.getTime();
let years = Math.floor(timeDiff / (1000 * 3600 * 24 * 365.25));
return years;
}