mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-20 01:09:35 +05:30
11 lines
373 B
JavaScript
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;
|
|
}
|