momentjs - Is there a way to make moment.js output "1 day" instead of "a day"? -
i'm using time x function of moment.js. when second parameter true
, result a day
. there way make 1 day
through api, or need string replace?
you can use string.replace method replace "a day"
"1 day"
.
or can try this:
var = moment([2007, 0, 29]); var b = moment([2007, 0, 28]); var differenceinmillisec = a.diff(b); var differenceindays = a.diff(b, 'days'); //output 1 day
Comments
Post a Comment