Here's the working googled answer:
min = cookies[:timezone].to_i
Time.zone = ActiveSupport::TimeZone[-min.minutes]
Just to make it clear, the javascript part:
if(!($.cookie('timezone'))) {
current_time = new Date();
$.cookie('timezone', current_time.getTimezoneOffset(), { path: '/', expires: 10 } );
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…