cancel
Showing results for 
Search instead for 
Did you mean: 

aqDateTime has AddDays and SubDays an interesting find

Highlighted
Frequent Contributor

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

4 REPLIES
Super Contributor

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.

Super Contributor

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

Community Hero

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.


I’ll be talking about “Hidden Treasures – TestComplete Script Extensions” at #SBConnect in October! Who’s joining me? Click here for tickets
Extensions available
Frequent Contributor

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

Watch a Video Interview
Top Kudoed Authors
Are You In?

Meet the Community Leaders!

SmartBear Connect is an excellent opportunity for training, in-person support, and networking.

GET YOUR TICKET WITH $100 OFF