(dateString)
| 1649 | |
| 1650 | // 验证并解析日期格式,如果格式不正确则返回false |
| 1651 | function parseDateOrFalse(dateString) { |
| 1652 | // 正则表达式,用于检查常见的日期格式(如 YYYY-MM-DD) |
| 1653 | if (!regex.combinedDateRegex.test(dateString)) return false; |
| 1654 | // 尝试解析日期,如果无效返回 false |
| 1655 | const date = new Date(dateString); |
| 1656 | return !isNaN(date.getTime()) ? date : false; |
| 1657 | } |
| 1658 | |
| 1659 | // 判断字符串是否不包含中文 |
| 1660 | function withoutChinese(text) { |
no outgoing calls
no test coverage detected