This commit is contained in:
Cheney
2025-02-28 15:06:44 +08:00
commit 8ff1cdbd15
2 changed files with 26 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
const notifier = require('node-notifier');
const cron = require('node-cron');
const dayjs = require('dayjs');
// 定义整点触发的任务
cron.schedule('0 * * * *', () => {
// 获取当前时间
const currentDate = dayjs();
const date = currentDate.format('YYYYMMDD');
const time = currentDate.format('HH:mm');
notifier.notify({
title: '整点报时',
subtitle : "当前日期 " + date,
message: '当前时间 ' + time,
});
});