I am using moment.js in my TypeScript (Ionic2/Angular2) project. Following on from this post, I now want to try out a plugin moment-duration-format
I have the npm packag
You are using duration
as a property instead of invoking it. Try:
let dd = moment.duration(400.99, 'hours').format('D:HH:mm');
This is actually not a TypeScript problem. It wouldn't work with JavaScript either. In JavaSctript you would get a runtime error while TypeScript doesn't let you do it at compile time (proving its worth).