I have a model with a datetime field, and is stored in UTC, how can I display that date in simple form gem in a specific timezone?
Already tried with the option input_html: {value: @model.date.in_time_zone('Eastern Time (US & Canada)')}
Note: I can't change the timezone of rails app
It will work if you set the timezone in the controller:
Example:
around_action :set_time_zone, if: :current_user
private
def set_time_zone(&block)
Time.use_zone(current_user.time_zone, &block)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With