[Vuejs]-Get different between date in DOM

0👍

If both dateList[0] and day.date are JS Date objects you can use getTime to get the time in milliseconds and then compute the difference.

<img v-if="(dateList[0].getTime() - day.date.getTime()) / (1000 * 60 * 60 ) >= 6" ... />

or even simpler you can just subtract them

<img v-if="(dateList[0] - day.date) / (1000 * 60 * 60 ) >= 6" ... />

Leave a comment