[JS] Determine whether the incoming content is a date and time



/**
 * 判断是否是日期格式
 * @param { Date } date 传入的日期: new Date() 或者 "2002-03-22" 或者 "2002/03/22" 等
 */
const isTypeDateFormat = (date) => !isNaN(Date.parse(date)) || date instanceof Date;


For more about date and time processing, please click this text to view

Guess you like

Origin blog.csdn.net/weixin_44244230/article/details/132086656