UI Builder: How to add 14days (2 weeks) in a field from data resource?

WNSN
Tera Contributor

Hi all,

 

I am trying to get "Updated" value via Data Resource in Repeater (UI Builder).

 

const dateItem = api.item.value.sys_updated_on.value;

I wonder how to add 14 days or 2 weeks in the script... any Idea?:)

 

1 ACCEPTED SOLUTION

Peter Bodelier
Giga Sage

Hi @WNSN,

 

var dateItem = api.item.value.sys_updated_on.value;
 var result = new Date(dateItem );
  result.setDate(result.getDate() + 14);

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

2 REPLIES 2

Peter Bodelier
Giga Sage

Hi @WNSN,

 

var dateItem = api.item.value.sys_updated_on.value;
 var result = new Date(dateItem );
  result.setDate(result.getDate() + 14);

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Vishal Birajdar
Giga Sage

Hi @WNSN 

 

Try below script :

 

const dateItem = api.item.value.sys_updated_on.value;

var futureDate = new GlideDateTime(dateItem);

futureDate.addDays(14);

 

VishalBirajdar7_0-1695040902739.png

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates