javascript - How can I set daternagepicker to allow local datetime selection instead of utc -


i using dan grossman's daterangepicker display range of datetime users selection. unfortunately datetime selected , passed backend in utc , such being saved database. need set daterangepicker display local time based on time zone selected earlier. know how deal this? tried adding timezone option ("01:00") doesn't seem make difference.

$('form .date_available').daterangepicker({   timezone: "01:00",   timepicker: true,   timepickerincrement: 30,   mindate: currentdate,   mintime: currenttime,   format: 'mm/dd/yyyy h:mm a',   formattime: 'h:mm a',   formatdate: 'mm/dd/yyyy' }); 

you need set time zone server in config/application.rb

config.time_zone = 'pacific time (us & canada)' 

or have timezone change users can add following application_controller.rb, , should save in settings user timezone:

around_filter :user_time_zone  def user_time_zone(&block)   if user_signed_in?     time.use_zone(current_user.time_zone, &block)   else     time.use_zone('pacific time (us & canada)', &block)   end end 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -