Hello R1 ,
One solution is to add a Text widget to dashboard and add below dashboard script. In the script, update the variable 'filterName' with name of Country filter, 'textWidgetID' with ID of Text widget and 'countryTimeZoneMapping' with area-time zone name mapping
dashboard.on('filterschanged', function(se, ev){
displayTime(se)
})
dashboard.on('widgetready', function(se, ev){
displayTime(se)
})
function displayTime(se){
let filterName = 'Country' //update the name of country filter
let textWidgetID = '6380c6426bc7f50039bf366b' //update widget-id of text widget
let selectedCountry = ''
//update area-timezone mapping
let countryTimeZoneMapping = {
'Brazil':'America/Sao_Paul',
'France':'Europe/Paris',
'Canada':'America/New_York',
'India':'Asia/Calcutta'
}
let filterObject = se.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 = new Date().toLocaleString('en-US', { timeZone: countryTimeZoneMapping[selectedCountry]});
$(`widget[widgetid="${textWidgetID}"] richtexteditor .wd`).text(dateString)
}
![]()
![]()
Please let me know if have any questions
Always here to help,
Harry from QBeeQ
[email protected]
QBeeQ - Gold Implementation and Development Partner
www.qbeeq.pl