Set time range from variable error

Hello, recently upgraded from v5.3.4 to v6.7.2

In version 5 i had a grafana variable the user could select which would set the variable to a JSON time format e.g. {from: “2020-04-15 22:00:00”, to: “2020-04-16 08:00:01”}. Then a bit of javascript code would check if the variable was different to the current time range and set the current range if so.

In version 6 its not working. Ive narrowed it down to when i set the javascript variable with the grafana variable i get a Uncaught SyntaxError: Unexpected token ‘&’.

Grafana Variable is $Shift. See code below.
script type=“text/javascript” language=“javascript”
var aaBC = new String();
aaBC = $Shift;
console.log(aaBC);