微信扫码登录
32
324
5155
元老级技术达人
使用道具 举报
0
15
166
注册会员
17
790
5913
论坛元老
1
18
84
3
50
541
高级会员
23
311
4357
368
中级会员
6
178
1519
金牌会员
510
2921
mr_chenxc 发表于 2023-11-6 10:59 复制到function节点报错
var now = new Date(); var isWorkday = now.getDay() >= 1 && now.getDay() <= 5; var isWeekend = now.getDay() === 0 || now.getDay() === 6; if (isWorkday) { var sentence = "工作日"; } else if (isWeekend) { var sentence = "休息日"; } msg.payload = { speak: sentence }; return msg;
var now = new Date(); var targetDate = new Date(2024, 1, 10); // 月份 - 1,1 即是 2 月 var daysRemaining = Math.ceil((targetDate.getTime() - now.getTime()) / (1000 * 60 * 60 * 24)); var sentence = `距离 春节 2024 年 2 月 10 日还剩 ${daysRemaining} 天。`; msg.payload = { speak: sentence }; return msg;
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )
GMT+8, 2025-8-27 09:55 , Processed in 1.705398 second(s), 12 queries , MemCached On.
Powered by Discuz! X3.5
© 2001-2025 Discuz! Team.