/** * 根据日期字符串获取星期几 * @param dateString 日期字符串(如:2020-05-02) * @returns {String} */ function getWeek(dateString) { var dateArray = dateString.split("-"); date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]); return "周" + "日一二三四五六".charAt(date.getDay()); };