UI Builder

saikumarkak
Tera Contributor

saikumarkak_0-1753071597820.png

Hi Team,
I have created the list in ui builder using list component. Here, the created field have created date and time but the time is setting 17:00:00 as default how can i change it to from 00:00:00  to 23:59:59.
  

4 REPLIES 4

Mark Manders
Mega Patron

What are the conditions on the list data source, because it feels like this is set as the default filter on the list. 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

@Mark Manders ,
Thank you for your reply.
i did not used any data source. Here i have taken two parameters and written the client script on ui builder and added that two parameters dynamically to the filter.

 

here is the script i have writte:

/**
* @Param {params} params
* @Param {api} params.api
* @Param {any} params.event
* @Param {any} params.imports
* @Param {ApiHelpers} params.helpers
*/
function handler({
api,
event,
helpers,
imports
}) {
var timeframe = api.context.props.query;
var date = timeframe.split("=")[1];
var days = date.split(" ")[0]; //30 days plus
var end = '';
console.log('date'+date);
console.log('days: '+days);
if (days.includes('-')) {
end = days.split("-");
var formattedStartDate = new Date(new Date().setDate(new Date().getDate() - end[1])).toISOString().split(' ')[0];
var formattedEndDate = new Date(new Date().setDate(new Date().getDate() - end[0])).toISOString().split(' ')[0];
api.setState("slatimeframestart", formattedStartDate);
api.setState("slatimeframeend", formattedEndDate);
} else {
end = days;
console.log(end);
var formattedStartDate = new Date(new Date().setDate(new Date().getDate() - 1000)).toISOString().split(' ')[0];
var formattedEndDate = new Date(new Date().setDate(new Date().getDate() - end[0])).toISOString().split(' ')[0];
api.setState("slatimeframestart", formattedStartDate + ' 00:00:00');
api.setState("slatimeframeend", formattedEndDate + ' 23:59:59');
}
console.log(formattedStartDate);
console.log(formattedEndDate);

 

}

here i have stated the time statically but in the list not appearing it is taking as 17:00:00 to 16:59:00.

This could very well be a local vs system time thingy. What timezone are you in and is the time difference to ServiceNow's system time about 7 hours? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark