In my Typescript Ionic 2 project, I am utilizing the moment.js library. To include it in my project, I use the following code snippet:
import * as moment from 'moment';
Once imported, I can use moment in my component like so:
let endDate = moment(data.endDate);
Now, I want to incorporate a plugin specific to moment.js - moment-weekday-calc from this repository: https://github.com/andruhon/moment-weekday-calc
I have installed the plugin via npm, but I'm encountering difficulties in making it work. I've attempted:
import * as moment from 'moment';
import 'moment-weekday-calc';
//(...) - section of my component's code
let test = moment().isoWeekdayCalc({
rangeStart: '1 Apr 2015',
rangeEnd: '31 Mar 2016',
weekdays: [1,2,3,4,5],
exclusions: ['6 Apr 2015','7 Apr 2015'],
inclusions: ['10 Apr 2015']
}); //260
The above code is throwing an error:
Typescript Error
Property 'isoWeekdayCalc' does not exist on type 'Moment'.
Do you have any suggestions on how I can successfully integrate this plugin into my Ionic/Cordova Typescript application?