32
321
4988
元老级技术达人
使用道具 举报
0
13
139
注册会员
17
790
5913
论坛元老
1
18
84
3
50
541
高级会员
23
307
4333
48
344
中级会员
6
178
1509
金牌会员
15
489
2791
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-6-26 21:24 , Processed in 0.932898 second(s), 26 queries .
Powered by Discuz! X3.5
© 2001-2025 Discuz! Team.