V1.0
This commit is contained in:
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user