js根据日期计算星期几的方法。
/** * js根据日期计算星期几 * @param date * @returns {string} */ function getWeekDay(date) { let dt = new Date(date.split("-")[0], date.split("-")[1] - 1, date = date.split("-")[2]), weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; return weekDay[dt.getDay()]; }