Forum Discussion
Hi R1 ,
Here is a widget script blox to fetch "updated timestamp" and convert it to timezone of selected country.
(assuming first column selected in 'Items' panel is "updated timestamp")
widget.on('processresult', function(se, ev){
let updatedtime = ev.result[0][0].Value //Update Time from item panel
let filterName = 'Country' //update the name of country filter
//update area-timezone mapping
let countryTimeZoneMapping = {
'Brazil':'America/Sao_Paul',
'France':'Europe/Paris',
'Canada':'America/New_York',
'India':'Asia/Calcutta'
}
let filterObject = ev.widget.dashboard.filters.$$items.find(el=>el.jaql.title == filterName)
if(filterObject && filterObject.jaql.filter && filterObject.jaql.filter.members)
selectedCountry = filterObject.jaql.filter.members[0]
let dateString =updatedtime.toLocaleString('en-US', { timeZone: countryTimeZoneMapping[selectedCountry]});
ev.result[0][0].Text = dateString
})
-Hari
Hi Hari,
Thanks for the help. I'm displaying the "updated timestamp" in my blox widget from the items panel. However, I'm not able to map the timestamp from the data model ( ex: 12/24/2022, 3:16 AM) to just one item on the left panel. The following is how the blox widget allows me to map the timestamp to the items panel. The date part of the timestamp is mapped to "Pulsetimedays" and the time part of the timestamp mapped to "Pulsetimeminute" and i display them on the widget using the following:
These are the formats for date and time i've selected in the blox widget for the timestamp to display. How do I concatenate these values in my script to form a single timestamp value?