Forum Discussion
Date formatting issue with Visual API v2.1
- 7 years ago
Hi v-viig
The reason formatting was not working for date time is because I have to pass date time object while formatting date time and not date time string. Strange thing is that with API v1.13.0 I was passing date time string and it was working fine but with API v2.1 I had to pass date time object.
I found this solution by looking at the source code of LineDotChart in visual.ts file @line 166.
Hi v-viig Thanks for reply.
Below is pbiviz.json file for visual.
{
"visual": {
"name": "visual",
"displayName": "Visual",
"guid": "visual",
"visualClassName": "Visual",
"version": "1.0.0",
"description": "",
"supportUrl": "",
"gitHubUrl": ""
},
"apiVersion": "2.1.0",
"author": {
"name": "",
"email": ""
},
"assets": {
"icon": "assets/icon.png"
},
"externalJS": [
"node_modules/d3/d3.js",
"node_modules/globalize/lib/globalize.js",
"node_modules/powerbi-visuals-utils-tooltiputils/lib/index.js",
"node_modules/globalize/lib/cultures/globalize.cultures.js",
"node_modules/powerbi-visuals-utils-typeutils/lib/index.js",
"node_modules/powerbi-visuals-utils-dataviewutils/lib/index.js",
"node_modules/powerbi-visuals-utils-formattingutils/lib/index.js"
],
"style": "style/visual.less",
"capabilities": "capabilities.json",
"dependencies": "dependencies.json",
"stringResources": []
}Hi v-viig
The reason formatting was not working for date time is because I have to pass date time object while formatting date time and not date time string. Strange thing is that with API v1.13.0 I was passing date time string and it was working fine but with API v2.1 I had to pass date time object.
I found this solution by looking at the source code of LineDotChart in visual.ts file @line 166.