[feat]Properly add timezone to events starttime and endtime; set now to be the time in conference timezone instead of the user s time zone in fullcalendar
This commit is contained in:
parent
03b12eafb0
commit
6777ffb0bb
6 changed files with 25 additions and 9 deletions
|
|
@ -133,6 +133,14 @@ class EventSchedule < ApplicationRecord
|
|||
other.schedule_id == schedule_id
|
||||
end
|
||||
|
||||
def start_time_in_conference_timezone
|
||||
time_in_conference_timezone(start_time)
|
||||
end
|
||||
|
||||
def end_time_in_conference_timezone
|
||||
time_in_conference_timezone(end_time)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def replaced_event_schedules
|
||||
|
|
@ -187,4 +195,10 @@ class EventSchedule < ApplicationRecord
|
|||
|
||||
errors.add(:schedule, "must be one of #{event.track.name} track's schedules") unless event.track.schedules.include?(schedule)
|
||||
end
|
||||
|
||||
def time_in_conference_timezone(time)
|
||||
time_in_tz = time.in_time_zone(timezone)
|
||||
time_in_tz -= time_in_tz.utc_offset
|
||||
time_in_tz
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue