I am using moment duration format to calculate total time duration it works fine, however when time duration goes in 4 digits it adds comma in hours (consider money format).
What I have:
moment.duration(33869100, 'seconds').format('hh:mm:ss', {trim: false})
Out put: 9,408:05:00 ---> note the hours have comma I need this format 9408:05:00 without comma no money format.
答案 0 :(得分:1)
我不确定Moment是否可以为您更改,但是您可以,只需进行替换即可:
/* using regex, .replace(/,/g, '') replaces all commas in case you run into large numbers */
moment.duration(33869100, 'seconds').format('hh:mm:ss', {trim: false}).replace(/,/g, '')
Here's a fiddle showing it working
编辑:请参阅@George的回答,Moment可以为您完成此操作
答案 1 :(得分:1)
您可以像这样简单地disable grouping
moment.duration(33869100, 'seconds').format('hh:mm:ss', {trim: false, useGrouping: false})