The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I am writing a simple custom visual and i would like to know how i could go about and use moment.js in that visual.
I saw there is a typescript def in the git-repo ->PowerBI-visuals/src/Clients/Typedefs/moment/moment.d.ts
Does that mean that moment.js is avaiable as a common lib, ready to use in custom visuals?
Solved! Go to Solution.
To develop a custom visual, please use the PowerBI Custom Visual CLI Tools. There you could find the tutorial on Adding External Libraries and Installing Typings for Libraries.
@greenelephant Can you share some more info about how you got this working? I added moment 2.18.1 using npm and it appears in my node_modules folder. Moment now comes with it's own type description file, so I added the moment.d.ts file to tsconfig.json:
"files": [ ".api/v1.7.0/PowerBI-visuals.d.ts", "node_modules/moment/moment.d.ts", "src/visual.ts" ]I then added the moment.js file to pbviz.json:
"externalJS": [ "node_modules/moment/min/moment.min.js" ],However, I'm not getting any moment-related namespace in Intellisense.
FYI: This answer on stack overflow solved my namespace problem with moment typings: https://stackoverflow.com/a/42290662/79271
glad you found a solution. Its been a while for me that i worked with powerbi and I cant remember how i made it work now
To develop a custom visual, please use the PowerBI Custom Visual CLI Tools. There you could find the tutorial on Adding External Libraries and Installing Typings for Libraries.