Page 1 of 1

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

Posted: Thu Nov 25, 2021 12:00 pm
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!

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

Posted: Thu Nov 25, 2021 1:36 pm
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.

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

Posted: Mon Nov 29, 2021 11:09 am
by ArnauINFR
It works fine!
Thank you for your help!

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

Posted: Mon Nov 29, 2021 12:32 pm
by Max Shamanov
Hello,

Let us know if you need any additional help.

Thank you.