17 lines
404 B
JavaScript
17 lines
404 B
JavaScript
//cron-worker.js just prints the current date and time every 5 seconds
|
|
|
|
import cron from 'node-cron';
|
|
|
|
cron.schedule('*/5 * * * * *', () => {
|
|
const now = new Date();
|
|
if (!isNaN(now)) {
|
|
const formatted = new Intl.DateTimeFormat('es-HN', {
|
|
dateStyle: 'full',
|
|
timeStyle: 'medium',
|
|
timeZone: 'America/Tegucigalpa',
|
|
}).format(now);
|
|
console.log('[cron]', formatted);
|
|
}
|
|
});
|
|
|