Hello Carlos,
I hope you can help me, please regarding how to set the local timezone (mine is AEST) Australian Eastern Standard Time, instead of getting the default UTC time.
I have a simple form that takes in the start time and it's by default in UTC time.
If I change the date and time and saved it, it will save it as UTC time.
But then in the show page, I displayed the time in local timezone and it is different with the UTC time (it's because AEST is 10 hours ahead of UTC).
How can I make the simple form to display the local time, instead of UTC time?
This is the portion of my simple form:
<%= f.input :start_time, as: :string, input_html: { class: 'datetimepicker', value: localize(f.object.start_time, :format => "%d/%m/%Y %I:%m %p %Z")} %>
<%= f.input :end_time, as: :string, input_html: { class: 'datetimepicker', value: localize(f.object.end_time, :format => "%d/%m/%Y %I:%m %p %Z")} %>
It will display in the form page:
8/08/2015 12:08 PM UTC
And this is my datetimepicker jquery in application.html.erb:
$('.datetimepicker').datetimepicker({
format:'d M Y H:i'
});
How to make simpleform to display the local user's timezone on the form page?
Can you give some suggestions, please?
Thank you,
Katherina