Reply
Contributor
Posts: 97
Registered: ‎04-24-2017

aqDateTime has AddDays and SubDays an interesting find

aqDateTime has two functions. When looking at the documentation for  aqDateTime methods, we dont see SubDays, but yet this function exsists. 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqdatetime/methods.html

If i type in aqDateTime.SubDays("01/02/2017", 1) you would expect the result "01/01/2017" but that isn't the case.

It seems as if aqDateTime.SubDays acts exactly the same as aqDateTime.AddDays. 

The result above will come out as "01/03/2017".

Very strange, i do not suggest using this feature as it does the same thing as add days when expected to do the opposite.

Yes i get that i can go AddDays (date, -1)

Just posting an interesting find

Community Expert
Posts: 413
Registered: ‎11-26-2009

Re: aqDateTime has AddDays and SubDays an interesting find

Using undocumented features is always a risk. They may be used for internal needs only and you never know why and how.

 

I remember a strange issue about TestComplete about 10 years ago, when it was impossible either to declare a variable MSG or to use it correctly. It was related to some internal variable with the same name.

Community Expert
Posts: 413
Registered: ‎11-26-2009

Re: aqDateTime has AddDays and SubDays an interesting find

LOL, the issue is still here Smiley Happy

 

Try running this code anywhere and you'll get JScript Runtime Error

MSG = 'any text';
function test1()
{
  Log.Message(MSG);
}

Change the name MSG to anything else and it will work just fine Smiley Happy

Posts: 4,374
Topics: 39
Kudos: 1,607
Solutions: 325
Registered: ‎11-30-2009

Re: aqDateTime has AddDays and SubDays an interesting find

Actually, I just tried in TC 12.40 to use aqDateTime.SubDays... and I got an "unknown identifier" error.

What version of TC are you using?


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Extensions available
Community Leaders Program
Highlighted
Contributor
Posts: 97
Registered: ‎04-24-2017

Re: aqDateTime has AddDays and SubDays an interesting find

You know what, this is interesting. I was running the function through a script extension, no errors but treated it like AddDays.  HMMM

Try QAComplete Now