Date and Time Utilities - elapsedtime function error

Hello,

I'm facing an issue I can't explain with the Date and Time Utilities plugin (more info here: https://community.appian.com/b/appmarket/posts/date-and-time-utilities).

The function elapsedtime takes two datetimes in parameter and calculates the total of elapsed time from years up to seconds between the two given dates.

It returns an int array with the elapsed years, months, days, hours, minutes, and seconds.

For instance, 

elapsedtime(
todatetime(date(1942,2,10)),
todatetime(date(2019,10,28))
)

works well and returns the following anwser: {77, 8, 18, 14, 52, 44}

But, in other cases, like this one: 

elapsedtime(
todatetime(date(1940,1,31)),
todatetime(date(2019,10,28))
)

the function throws the following error : "The first calendar should be dated before the second calendar."

For information, I am working with 19.3 (Cloud) version.

Does anyone is facing the same issue with this function or sees if something is wrong in calling it this way?

Thanks a lot,

Valerian

  Discussion posts and replies are publicly visible

Parents
  • +2
    Certified Lead Developer

    Seems like an issue in the plug-in to me - several data time comparisons I tried throw the same error.

    I wrapped both dates in the gmt() function to force a time component and that does seem to work. For example:

    elapsedtime(
    todatetime(gmt(date(1940,1,31))),
    todatetime(gmt(date(2019,10,28)))
    )

    returns:

    Without reviewing the code, I can't say why this would work this way but maybe this can be a workaround for you for now.

Reply
  • +2
    Certified Lead Developer

    Seems like an issue in the plug-in to me - several data time comparisons I tried throw the same error.

    I wrapped both dates in the gmt() function to force a time component and that does seem to work. For example:

    elapsedtime(
    todatetime(gmt(date(1940,1,31))),
    todatetime(gmt(date(2019,10,28)))
    )

    returns:

    Without reviewing the code, I can't say why this would work this way but maybe this can be a workaround for you for now.

Children