I have already many test cases in which we are using saved dates in UTC format. But now I have to change some reports in PDF and I did used following method
def display_user_zone_date
model.created_at.in_time_zone(Time.now.utc_offset)
end
It is working perfectly. But issue is my test case failing. as I have hard coded date comparing with model
expect(model.display_user_zon_date).to eq 'YYYY Thu, 5 May 2021 05:00'
but it should be
expect(model.display_user_zon_date).to eq 'YYYY Thu, 5 May 2021 01:00'
I can change on local and it will work but issue is I have to run test cases on Github so again it will be different as per that machine time zones. And Is Time.zone.now
gets browser time or system time. I think it is system time so how can I get browser time.
Any idea how can I fix it.