VMware Cloud Community
colinj
Contributor
Contributor
Jump to solution

Add hours to a date?

So I'm looking at the available pieces that I can put together in a workflow schema and I see that there is one labeled "Add hours to date" so I thought I would give it a try. The code that is uses is as follows:

//Auto-generated script
if (aDate != null) {
    aDate.addHours(hours) ;
}
else  {
    throw "'aDate' is NULL";
}

When I try and use this I get the following error:

TypeError: Cannot find function addHours. (Workflow:New workflow / Add hours to date (item2)#2)

I've searched the API and there does not seem to be any sort of addHours method. Is this a known problem? Am I missing a plugin?

Thanks!

Colin J.

Reply
0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Definitely a bug. Never caught this one in 4 years of vCO use. Actualy I never noticed the box ...

Please report it to VMware Global Support Services.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

Reply
0 Kudos
5 Replies
robrtb12
Enthusiast
Enthusiast
Jump to solution

I tested this and got the same result as you did, there is no method of 'addHours' :smileyconfused:

I'm using vCO 4.1.1 build 733

In the event you need a workaround, create a new scriptable task with the same inputs and outputs and use this code:

if (aDate != null) {
//aDate.addHours(hours) ;
aDate.setHours(aDate.getHours() + hours);
}
else  {
throw "'aDate' is NULL";
}

Glad to finally get a chance to give back to the community!

-Bobby

cdecanini_
VMware Employee
VMware Employee
Jump to solution

Definitely a bug. Never caught this one in 4 years of vCO use. Actualy I never noticed the box ...

Please report it to VMware Global Support Services.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Hi all,

Just letting you know that this has been identified as a bug by VMware Support.

cdecanini_
VMware Employee
VMware Employee
Jump to solution

Thanks for the update and for submitting it.

This will help the product to be better.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
colinj
Contributor
Contributor
Jump to solution

WOOHOO! My first bug! :smileysilly:

Reply
0 Kudos