简体   繁体   中英

Getting date by Year and Week number and get Week Number and Year Number back

I'm trying to generate date by year, week and day number ie

let date = moment().year(2019).isoWeek(1).isoWeekday(1).toDate(); 
//Mon Dec 31 2018 11:56:45 GMT+0100 (Central European Standard Time)

the problem i'm facing when i want to get year and week from this generated date

moment(date).year() //2018 
moment(date).isoWeek() // 1 

NOT SURE HOW TO SOLVE THIS

阅读有关年份访问器文档 ,您将找到“ 周年(ISO)”部分:

moment(date).isoWeekYear() // 2019 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM