Struggling to modify the Duration interface in the momentjs package
I need to calculate months based on a 30-day period, but version 2.24.0 returns around 0.94 months instead of 1
Unfortunately, my attempt to add a function like this has not been successful:
Duration.getRealMonths = function () {
return Math.floor(this.as('days')/30);
}
Here's a stack blitz for reference: https://stackblitz.com/edit/angular-moment-example-6kknck
The expected behavior is for:
let duration: Duration = moment.duration(30,'days');
to return 1