magma-labs / magma-chat

Ruby on Rails 7-based ChatGPT Bot Platform
https://magmachat.ai
Other
209 stars 26 forks source link

Invalid timezone error #70

Open navjeetc opened 1 year ago

navjeetc commented 1 year ago

I get a "invalid time zone" error on line Time.use_zone(current_user.time_zone, &block) in application controller as the code calendar.time_zone.split('/').last.gsub('_', ' ') in sessions controller strips of America from America/New_York. If I remove .split('/').last.gsub('_', ' ') all is good. Is that an appropriate fix and should I create a PR or not?

softr8 commented 1 year ago

Yes please, according to the documentation, google returns the timezone Formatted as an IANA Time Zone Database name, e.g. "Europe/Zurich" And Time.find_zone! already expects this format, maybe we need to fallback to app time zone? this line needs to be adjusted as well, and lastly, we might need to create a presenter to show in the UI a formatted timezone name

piscespieces commented 1 week ago

Same issue. I tried with @navjeetc approach by deleting .split('/').last.gsub('_', ' ') but kept getting this error.

Then I completely deleted the set_time_zone from ApplicationController and I still get this error!

Invalid Timezone: Chicago
[app/controllers/application_controller.rb:56:in `set_time_zone'](http://localhost:3000/conversations#)

I have run already docker compose down && docker compose up

I'm just craking up this codebase for first time, not sure what am I doing wrong here