Reputation: 325
I use moment.js and I just want to add the word "day(s)" after a number. Ex:
Moment(3).function('dd') // 3 days
Any ideas?
Upvotes: 0
Views: 225
Reputation: 107536
You can use format() with some character escaping:
format()
moment(3).format('d [day(s)]'); // 3 day(s)
alert(moment(3).format('d [day(s)]')); // 3 day(s)
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
Upvotes: 1