Set datetime as today on dashboard in 5.1 version

Screenshot 2024-11-04 at 11.13.30 AM
hello helical team, I am not able to create custom column on 5.1 version of helical and set datetime as today or previous day. How can i do that?
I use to create drop down list- set value as date range and then create a custom column to write css to set the dashboard datetime as a day before in 4.1. Below is the css i use.
if(Dashboard.getVariable(‘dropDownList’) == ‘Current Day’){
var today = new Date();
var dd = today.getDate() < 10 ? ‘0’ + today.getDate() : today.getDate();
var mm = (today.getMonth() + 1) < 10 ? ‘0’ + (today.getMonth() + 1) : (today.getMonth() + 1);
var yyyy = today.getFullYear();
var today = yyyy + ‘-’ + mm + ‘-’ + dd;
Dashboard.setVariable(‘2monthEnd’,today + ’ 23:59:59.000’);
Dashboard.setVariable(‘2monthStart’,today + ’ 00:00:00.000’);
}

							else{
								var today = new Date();
							  today.setDate(today.getDate() - 1);
								var dd = today.getDate() < 10 ? '0' + today.getDate() : today.getDate();
								var mm = (today.getMonth() + 1) < 10 ? '0' + (today.getMonth() + 1) : (today.getMonth() + 1);
								var yyyy = today.getFullYear();
								var today = yyyy + '-' + mm + '-' + dd;
								Dashboard.setVariable('EndDate',today + ' 23:59:59.000');
								Dashboard.setVariable('StartDate',today + ' 00:00:00.000'); 	 
							}		


							if(Dashboard.getVariable('dropDownList') == 'Current Day'){
								$("#8ajst3eksu6").show();
								$("#2i5xrcxgq7n").show();
							}
							else{
								$("#8ajst3eksu6").show();
								$("#2i5xrcxgq7n").show();  
							}

I found add css option in 5.1 dashboard but it just doesn’t work. Can you please me with this issue?

Learn how to use relative dates using this : Relative Date Usage - Helical Insight

From version 5.0 this has been simplified a lot. So while report designing level you can set it for options like today, last 7 days, yesterday, etc and then use that as a filter at the dashboard level.