Hi,
Found a way to achieve this using Blox widget, and display the current timezone of the country based on the dashboard filter using the below script. I'm doing the conversion based on the current date and time. However, I want to use the last build date of the live model for conversion (to denote when data was last refreshed). From the documents and old community posts, i got to know how to get the last build time of an elastic cube. How do i achieve/ access the last build time of a live model in my widget script?
![]()
widget.on("ready", function(w, args) {
//make sure the target BloX text has an "id" attribute of "text-to-change"
var yourFilterTitle = "Market"; //insert your filter title here
//ASSUMPTION: you're using an ordinary "List"-style filter
var filterDetails = w.dashboard.filters.$$items.find(function(element){
return element.jaql.title === yourFilterTitle;
}).jaql.filter;
//$("#text-to-change").text(filterDetails.members + ": " + filterDetails.members)
if (filterDetails.members == "France" || filterDetails.members == "Italy" || filterDetails.members == "Netherlands") {
let dateString = new Date().toLocaleString('en-US', { timeZone:'Europe/Paris'});
$("#text-to-change").text(filterDetails.members + ": " + dateString + " CET")
}
else if(filterDetails.members == "United Kingdom"|| filterDetails.members == "UK"){
let dateString = new Date().toLocaleString('en-US', { timeZone:'Europe/London'});
$("#text-to-change").text(filterDetails.members + ": " + dateString + " GMT")
}
else if(filterDetails.members == "United States of America"|| filterDetails.members == "USA"|| filterDetails.members == "US"){
let dateString = new Date().toLocaleString('en-US', { timeZone:'America/Phoenix'});
$("#text-to-change").text(filterDetails.members + ": " + dateString + " MST")
}
});