我尝试使用moment.js
检索一周中的相应日期// e.dayOfTheWeek = 2;
let dayOfTheWeek = moment().day(e.dayOfTheWeek);
console.log(dayOfTheWeek);
返回以下内容
Moment {_isAMomentObject: true, _isUTC: false, _pf: Object, _locale: Locale, _d: Tue Mar 01 2016 13:35:40 GMT-0500 (Eastern Standard Time)…}
希望它返回Tuesday
我做错了什么?
还尝试了let dayOfTheWeek = moment().isoWeekday(e.dayOfTheWeek);
相同的结果
答案 0 :(得分:1)
尝试:
moment().isoWeekday(e.dayOfTheWeek).format('dddd')