Yes, you can!
Rewrite your JS code into function with one argument (timelimit) and put it into some external file. Then you can call the function from view and pass that
@timeleft variable as JS function argument.
#controller @time_left = Time.now.to_i - 3.hours.to_i