TimeSpan Problem

Stimulsoft Reports.JS discussion
Post Reply
markb
Posts: 17
Joined: Fri Jul 07, 2017 10:56 am

TimeSpan Problem

Post by markb »

Hi

There appears to be quite a disparity between TimeSpan in Stimulsoft against TimeSpan in C#. In my test case I'm attempting to compare the time between two dates, which returns a TimeSpan, but due to the irregular return values, it makes it very difficult to use.

C#
(Convert.ToDateTime("2017/01/01 12:30:00") - Convert.ToDateTime("2017/01/01 11:00:00")).Minutes = 30
(Convert.ToDateTime("2017/01/01 12:30:00") - Convert.ToDateTime("2017/01/01 11:00:00")).Hours = 1
(Convert.ToDateTime("2017/01/01 12:30:00") - Convert.ToDateTime("2017/01/01 11:00:00")).TotalMinutes = 90
(Convert.ToDateTime("2017/01/01 12:30:00") - Convert.ToDateTime("2017/01/01 11:00:00")).TotalHours = 1.5

Stimulsoft Expression
DateDiff(Convert.ToDateTime("2017/01/01 12:00:00"),Convert.ToDateTime("2017/01/01 11:00:00")).Minutes = 0
DateDiff(Convert.ToDateTime("2017/01/01 12:00:00"),Convert.ToDateTime("2017/01/01 11:00:00")).Hours = 1

DateDiff(Convert.ToDateTime("2017/01/01 12:30:00"),Convert.ToDateTime("2017/01/01 11:00:00")).Minutes = 30
DateDiff(Convert.ToDateTime("2017/01/01 12:30:00"),Convert.ToDateTime("2017/01/01 11:00:00")).Hours = 1.5

As you can see from the stimulsoft examples above, you seem to use "C# Minutes" for minutes and "C# TotalHours" for hours. If the intent is to use total values, as per hours and days, then minutes should be 60 and 90. Personally I would much prefer to have both options, i.e. TotalMinutes and Minutes.

Regards

Mark
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: TimeSpan Problem

Post by Edward »

Hi Mark,

It looks like there is a bug, but I was not able to reproduce it still. Do you mind to attach the sample mrt template with your tests?
Also I checked for the issue on the latest version. And what was the version you used to kindly test that difference for the TotalHours?

Thank you,
Edward
markb
Posts: 17
Joined: Fri Jul 07, 2017 10:56 am

Re: TimeSpan Problem

Post by markb »

Hi Edward

I have attached an example to show the problem. Basically if you are using TotalHours for the Hours property, then you must use TotalMins for the Mins property, to maintain consistency. I am using version JS 2017.1.11.

Also, this may apply across the board with your other reporting tools, as I see the same values when running through the flash viewer.

Regards

Mark
Attachments
Time Test.mrt
(12.81 KiB) Downloaded 296 times
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: TimeSpan Problem

Post by HighAley »

Hello, Mark.

Thank you for the sample. The Total... properties were not added to the Reports.JS.
We are attending to implement these properties in our next build.

Thank you.

Ticket reference: #3149908
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: TimeSpan Problem

Post by HighAley »

Hello, Mark.

We have made an improvement.
Now all properties like Minutes, Hours and etc. as well TotalMinutes, TotalHours and others.
Please, check our next build.

Thank you.
Post Reply