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

dynamic DatePicker value isn't being set correctly #18523

Merged
merged 1 commit into from
Mar 6, 2019

Conversation

d-m-u
Copy link
Contributor

@d-m-u d-m-u commented Mar 5, 2019

Dynamic date pickers and datetime pickers are sometimes called with time objects, not strings, and so we need to ensure they're strings before we try and feed them into DateTime.parse in the model.

normalize_automate_vals gets called with ActiveSupport::TimeWithZone.

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

@d-m-u
Copy link
Contributor Author

d-m-u commented Mar 5, 2019

@miq-bot add_label bug
@miq-bot assign @gmcculloug
@miq-bot add_reviewer @eclarizio
@miq-bot add_reviewer @bdunne

@d-m-u d-m-u changed the title dynamic DatePicker value isn't being set correctly [WIP] dynamic DatePicker value isn't being set correctly Mar 5, 2019
@miq-bot miq-bot added the bug label Mar 5, 2019
@miq-bot miq-bot requested review from eclarizio and bdunne March 5, 2019 21:18
@d-m-u d-m-u changed the title [WIP] dynamic DatePicker value isn't being set correctly dynamic DatePicker value isn't being set correctly Mar 5, 2019
@d-m-u
Copy link
Contributor Author

d-m-u commented Mar 5, 2019

@miq-bot add_label hammer/yes

Copy link
Member

@eclarizio eclarizio left a comment

Choose a reason for hiding this comment

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

👍

Small correction to the description though: I don't think it was always called with a Time object, since the value is coming from automate. I think I just assumed it was a string already when I wrote the original DateTime.parse, and my automate methods I'm pretty sure I just used a string to set my fields.

@@ -86,7 +86,7 @@

context "when the automate hash has a value" do
context "when the value is a date format" do
let(:value) { "01/02/2015" }
let(:value) { Time.utc(2015, 01, 02) }
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we test both the old string format as well as the Time object?

@miq-bot
Copy link
Member

miq-bot commented Mar 6, 2019

Checked commit d-m-u@764e1e3 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 1 offense detected

app/models/dialog_field_date_control.rb

@gmcculloug gmcculloug merged commit e87f93a into ManageIQ:master Mar 6, 2019
@gmcculloug gmcculloug added this to the Sprint 107 Ending Mar 18, 2019 milestone Mar 6, 2019
@d-m-u d-m-u deleted the datepicker_thing branch September 26, 2019 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants