fix cronworker y conexion prisma api
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// planilla/api/server.js
|
// planilla/api/server.js
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { PrismaClient } from '@prisma/client';
|
import { PrismaClient } from 'prisma/generated/prisma/client';
|
||||||
const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
//cron-worker.js just prints the current date and time every 5 seconds
|
|
||||||
|
|
||||||
import cron from 'node-cron';
|
import cron from 'node-cron';
|
||||||
|
|
||||||
cron.schedule('*/5 * * * * *', () => {
|
cron.schedule('*/5 * * * * *', () => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
if (!isNaN(now)) {
|
if (!isNaN(now)) {
|
||||||
const formatted = new Intl.DateTimeFormat('es-HN', {
|
const formatted = now.toISOString(); // ✅ siempre funciona, sin locales
|
||||||
dateStyle: 'full',
|
|
||||||
timeStyle: 'medium',
|
|
||||||
timeZone: 'America/Tegucigalpa',
|
|
||||||
}).format(now);
|
|
||||||
console.log('[cron]', formatted);
|
console.log('[cron]', formatted);
|
||||||
|
} else {
|
||||||
|
console.log('[cron] Fecha inválida');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user