문제

I am using Time.zone.now to get the user's time.

I think that this is wrong. Can you confirm that it is wrong? How can I get the user's time?

Who is setting Time.zone on my server?

도움이 되었습니까?

해결책

Yes this is wrong. Time.zone is whatever your application's timezone is set to. This is usually set in application.rb

config.time_zone = 'UTC'

If you want a user's timezone, you'll need to either get it from the client side via JavaScript or let the user set it themselves in your application.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top