1
0
Fork 0

check if the file is older than an hour

This commit is contained in:
Ryan Mwangi 2024-10-24 15:21:56 +03:00
parent 96e25f7169
commit bab040df0f
1 changed files with 4 additions and 0 deletions

View File

@ -118,6 +118,10 @@ app.get('/calendar/:name', async (req, res) => {
const stats = fs.statSync(icsFilePath);
const lastModified = new Date(stats.mtime);
const now = new Date();
// Check if the file is older than one hour
if (now - lastModified > 60 * 60 * 1000) {
console .log('Refreshing calendar data...');
}
}
}