简体   繁体   中英

Adding hour using react-moment

I'm calculating the time and displaying it in bar for each hour. On hovering the bar I need to display the current hour and the next bars hour. For example, the bars will range from 12 -24 pm and on hovering 1 AM I need to show like 1-2 AM, similarly on hovering 3 AM I need to show 3-4AM. I used the map to iterate the hours and value. Using moment I tried with add hour: 1 its not working.

The code I used using react-moment, on consoling hourValue I'm getting the same hours value Even after adding 1hour.IS there any way to do it?

const hourValue = <Moment add={{ minutes : '60' }} format ='HH A'>{value.hours}</Moment>;

在minutes属性中使用Integer而不是String

const hourValue = <Moment add={{ minutes : 60 }} format ='HH A'>{value.hours}</Moment>;

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