日期格式
音药
卷起来
展开
-
element 获取当前日是第几周
const isDate = function(date) { if (date === null || date === undefined) return false; if (isNaN(new Date(date).getTime())) return false; if (Array.isArray(date)) return false; return true;}; const getWeekNumber = function(src) { if (!isDate(s.原创 2022-03-07 09:39:15 · 429 阅读 · 2 评论 -
判断日期格式是否正确
export function strDateTime(str) { const strArr = str.split('-'); const rule = /^(\d{4})-(\d{2})-(\d{2})$/; if (!rule.test(str)) { return false; } /** * 判断月是否正确 * */ if (strArr[1] > 12 || strArr[1] <= 0) { return false; }原创 2021-11-19 15:05:37 · 124 阅读 · 0 评论