0👍
✅
When you use momentJs you have to use an entire date string, you could just append any date to it and it should work for you:
stateTimeConfig.labels = data.map(item => moment('2019-01-01 '+ item.state_time).format('HH:mm'))
0👍
You could pass specific parser string to moment() if you know the format that you want to parse.
See documentation at MomentJs Parsing.
You can see an example of using it at Example codepen.
Solution:
stateTimeConfig.labels = data.map(item => (
moment(item.state_time, 'HH:mm:ss').format('HH:mm')
))
Source:stackexchange.com