forked from ryanmwangi/CalMerger
check if the file is older than an hour
This commit is contained in:
parent
96e25f7169
commit
bab040df0f
|
@ -118,6 +118,10 @@ app.get('/calendar/:name', async (req, res) => {
|
||||||
const stats = fs.statSync(icsFilePath);
|
const stats = fs.statSync(icsFilePath);
|
||||||
const lastModified = new Date(stats.mtime);
|
const lastModified = new Date(stats.mtime);
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
// Check if the file is older than one hour
|
||||||
|
if (now - lastModified > 60 * 60 * 1000) {
|
||||||
|
console .log('Refreshing calendar data...');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue