Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed schedule editor to convert/save start time correctly #3671

Merged
merged 1 commit into from
Mar 23, 2018

Conversation

h-kataria
Copy link
Contributor

Need to only pass date to create_time_in_utc method call, prior to fix code was passing in datetime as "Mon Mar 12 2018 20:00:00 GMT-0400 (EDT) 1:5:00", having timezone and time in the start_date parameter was messing the conversion up.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1558627

@lgalis please review/test

@dclarizio please review.

before:
schedule_edit_before

schedule_summary_before

after:
schedule_edit_after

schedule_summary

@lgalis
Copy link
Contributor

lgalis commented Mar 22, 2018

@h-kataria - I see the date still not being saved correctly ( either once or hourly).
If I set today's date ( 3/21) and the time to an hour or 2 in the future, the date is saved as the day before (3/20).

screenshot from 2018-03-21 21-51-27
screenshot from 2018-03-21 21-51-38

@h-kataria h-kataria force-pushed the schedule_editor_start_time_fix branch from 13c6b06 to 9b71354 Compare March 22, 2018 15:45
@h-kataria
Copy link
Contributor Author

@lgalis @mzazrivec please review/test

@mzazrivec
Copy link
Contributor

Tested, it seems to be working correctly, changes look good.

@lgalis Laura, could you re-verify as well, please? Thanks.

@lgalis
Copy link
Contributor

lgalis commented Mar 22, 2018

When a schedule is added or edited, the new date chosen is now shown correctly in the list of schedules. When the same schedule is open again for editing, it will still show the previous day.

Update: to reproduce the problem, add a schedule for the current day , at say 22:10, time zone can stay UTC, save.
Open the schedule added for editing, and just change the time to a bit earlier, say 22:05 - save. The day now will be the day earlier.

Need to only pass date to create_time_in_utc method call, prior to fix code was passing in datetime as "Mon Mar 12 2018 20:00:00 GMT-0400 (EDT) 1:5:00", having timezone and time in the start_date parameter was messing the conversion up. Changed miq_datepicker.js to convert string into moment first and then convert it to utc, that solves the issue where Date being sent upto server was -1 day of selected day.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1558627
@h-kataria h-kataria force-pushed the schedule_editor_start_time_fix branch from 9b71354 to 413e81d Compare March 22, 2018 18:40
@h-kataria
Copy link
Contributor Author

@lgalis please re-test, fixed test case where only time change to existing schedule was saving date as -1 day

@miq-bot
Copy link
Member

miq-bot commented Mar 22, 2018

Checked commit h-kataria@413e81d with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🍰

Copy link
Contributor

@lgalis lgalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tested in the UI, thank you Harpreet!

@dclarizio dclarizio merged commit b3adc09 into ManageIQ:master Mar 23, 2018
@dclarizio dclarizio added this to the Sprint 82 Ending Mar 26, 2018 milestone Mar 23, 2018
simaishi pushed a commit that referenced this pull request Mar 23, 2018
Fixed schedule editor to convert/save start time correctly
(cherry picked from commit b3adc09)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1560104
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit f86099aeb01c2b63778fa88f549b3e45f16baacb
Author: Dan Clarizio <[email protected]>
Date:   Fri Mar 23 07:48:13 2018 -0700

    Merge pull request #3671 from h-kataria/schedule_editor_start_time_fix
    
    Fixed schedule editor to convert/save start time correctly
    (cherry picked from commit b3adc09d124863f63e535e448b5e244ddff67c7c)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1560104

@h-kataria h-kataria deleted the schedule_editor_start_time_fix branch April 16, 2018 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants