Don't show time in a table with a date field JS

Stimulsoft Reports.JS discussion
Post Reply
ArnauINFR
Posts: 21
Joined: Fri Nov 05, 2021 10:01 am

Don't show time in a table with a date field JS

Post by ArnauINFR »

Hi. I'm new doing a Report in JS and I'm having a little problem...

I pass an array as a JSON string with some fields, and one of these is an only date field (with no time) Ex: "01/01/2020".

I have the problem when the report returns me that example as "01/01/2020 00:00:00".

I have this code:

Code: Select all

var jsonData = JSON.parse(jsonString.value);
var dataSet = new Stimulsoft.System.Data.DataSet();
dataSet.readJson(jsonData);

var report = new Stimulsoft.Report.StiReport();
report.regData("data", "data", dataSet);

var dataSource = new Stimulsoft.Report.Dictionary.StiDataTableSource(data.tableName, data.tableName, data.tableName);
dataSource.columns.add(new Stimulsoft.Report.Dictionary.StiDataColumn("date1", "date1", "date1"));
If you could help me to find the way to change it, I'll appreciate it!
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Don't show time in a table with a date field JS

Post by Max Shamanov »

Hello,

try to use following code to read date in your json as a string.

Code: Select all

Stimulsoft.System.Data.DataSet.tryParseDateTime = false;
If it doesn't help you, please clarify which version are you use. Or send us a demo project.

Thank you.
ArnauINFR
Posts: 21
Joined: Fri Nov 05, 2021 10:01 am

Re: Don't show time in a table with a date field JS

Post by ArnauINFR »

It works fine!
Thank you for your help!
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

Re: Don't show time in a table with a date field JS

Post by Max Shamanov »

Hello,

Let us know if you need any additional help.

Thank you.
Post Reply