I am looking to integrate the JDateFormatParser plugin with Moment.js in my Angular 4 application.
Successfully installed and implemented Moment.js using:
npm install moment --save
Imported it into my .ts file:
import * as moment from 'moment';
Everything is working as expected.
Next, I added the JDateFormatParser plugin by running:
npm install moment-jdateformatparser --save
When trying to use it in my code:
moment().toJDFString(moment.localeData().longDateFormat('L'))
My IDE showed an error message:
TS2339:Property 'toJDFString' does not exist on type 'Moment'.
Referring to this answer, I attempted to fix it using casting:
(<any>moment()).toJDFString(moment.localeData().longDateFormat('L'))
The IDE error was resolved, but now the console displays:
TypeError: WEBPACK_IMPORTED_MODULE_6_moment(...).toJDFString is not a function
Any suggestions on how to properly utilize this?