简体   繁体   中英

Find the current week or post week using new date in moment js

how to find it is a current week or previous week using the timestamp? is it possible to find using moment js

const dateEnd = moment(1518331101107);

I need to write if condition if it is the current week I need to through the alert

Find the week of a timestamp:

moment(1518331101107).week()    // =>  7

Find the current week:

moment().week()                

You can do you comparaison:

if(moment(1518331101107).week() == moment().week()){
   //Do something
}

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