自定义函数,自动获取每月天数! 户枢不蠹Lv.2入道 发布于 2023-04-24 22:26 最后回复 2023-04-25 11:23:28 分享 收藏 复制链接 新浪微博 微信扫一扫 分享 1 回复958 浏览 function getMonthLength(date) { let d = new Date(日期); // 将日期设置为下月一号 d.setMonth(d.getMonth()+1); d.setDate('1'); // 获取本月最后一天 d.setDate(d.getDate()-1); return d.getDate(); } return getMonthLength(日期) 效果就是选择日期的时候,自动计算该时间的天数。
大佬~可否多分享点自定义函数?对我们这种不会代码的人实在是太友好啦 🎉️ 👍