mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-20 02:19:34 +05:30
(refactor): switched to auto age and yoe calculation and improved load time by replacing render blocking scripts
This commit is contained in:
10
htdocs/assets/js/utility-functions.js
Normal file
10
htdocs/assets/js/utility-functions.js
Normal file
@@ -0,0 +1,10 @@
|
||||
//---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;
|
||||
}
|
||||
Reference in New Issue
Block a user