Update calendar event time correctly across DST window
Trigger change events on time inputs before time data extraction so the data layer is updated before further usage. fixes LS-3707 flag = none Test plan: - Create a calendar event with a start date before a DST window - Edit the event through 'More options' and update the day to a day inside the DST period - Notice that the start time is not an hour later Change-Id: I7274c9e3a9ac52edb51186fa49a8d7d3152f65e1 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/309579 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Jonathan Guardado <jonathan.guardado@instructure.com> QA-Review: Jonathan Guardado <jonathan.guardado@instructure.com> Product-Review: Luis Oliveira <luis.oliveira@instructure.com>
This commit is contained in:
parent
859063cee6
commit
2bad222748
|
@ -527,6 +527,19 @@ describe "calendar2" do
|
|||
expect(child_event.reload.end_at).to eq(end_at)
|
||||
end
|
||||
end
|
||||
|
||||
it "updates the event to the correct time when saving across DST window" do
|
||||
@user.time_zone = "America/Denver"
|
||||
@user.save!
|
||||
start_at = DateTime.parse("2022-03-01 1:00pm -0600")
|
||||
event = CalendarEvent.create!(context: @course, start_at: start_at)
|
||||
get "/courses/#{@course.id}/calendar_events/#{event.id}/edit"
|
||||
expect(f("#more_options_start_time").attribute(:value)).to eq("12:00pm")
|
||||
replace_content(f("[name=\"start_date\"]"), "2022-03-14")
|
||||
wait_for_new_page_load { more_options_submit_button.click }
|
||||
get "/courses/#{@course.id}/calendar_events/#{event.id}/edit"
|
||||
expect(f("#more_options_start_time").attribute(:value)).to eq("12:00pm")
|
||||
end
|
||||
end
|
||||
|
||||
context "assignment creation" do
|
||||
|
|
|
@ -444,9 +444,9 @@ export default class EditCalendarEventView extends Backbone.View {
|
|||
const start_at_key = start_date_key.replace(/start_date/, 'start_at')
|
||||
const end_at_key = start_date_key.replace(/start_date/, 'end_at')
|
||||
|
||||
const start_date = this.$el.find(`[name='${start_date_key}']`).data('date')
|
||||
const start_time = this.$el.find(`[name='${start_time_key}']`).data('date')
|
||||
const end_time = this.$el.find(`[name='${end_time_key}']`).data('date')
|
||||
const start_date = this.$el.find(`[name='${start_date_key}']`).change().data('date')
|
||||
const start_time = this.$el.find(`[name='${start_time_key}']`).change().data('date')
|
||||
const end_time = this.$el.find(`[name='${end_time_key}']`).change().data('date')
|
||||
if (!start_date) return
|
||||
|
||||
data = _.omit(data, start_date_key, start_time_key, end_time_key)
|
||||
|
|
Loading…
Reference in New Issue