Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
User | Count |
---|---|
5 | |
4 | |
4 | |
2 | |
2 |
User | Count |
---|---|
8 | |
4 | |
4 | |
4 | |
3 |