Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Explicitly set seconds to 0 from selector #4559

Merged
merged 7 commits into from
Feb 16, 2017
Merged

Conversation

jacogr
Copy link
Contributor

@jacogr jacogr commented Feb 15, 2017

Be explicit rather than assuming that timeselector zeros seconds. Sets -

  • ms to 0 (ignored, not passed through to Parity)
  • sec to 0 (be explicit in expectation)

If we do change the time selector component to be granular, the seconds setting can be removed.

@jacogr jacogr added A0-pleasereview 🤓 Pull request needs code review. B0-patch labels Feb 15, 2017
store.setConditionDateTime('testingDateTime');
expect(store.condition.time).to.equal('testingDateTime');
it('sets the datetime', () => {
const testTime = new Date('1973-06-11 07:52');
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we test that it actually sets the seconds to 0 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

What about this?

const testTime = new Date('1973-06-11 07:52:17');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, can test additionally.

@@ -104,6 +104,9 @@ export default class GasPriceEditor {
}

@action setConditionDateTime = (time) => {
time.setMilliseconds(0); // ignored by/not passed to Parity
Copy link
Contributor

Choose a reason for hiding this comment

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

Potentially dangerous as it mutates time instead of cloning it using new Date(time).

Copy link
Contributor Author

@jacogr jacogr Feb 15, 2017

Choose a reason for hiding this comment

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

Verified that it doesn't affect the either the MUI date or time components used with manual testing prior to pushing (and initial implementation).

These two separate UI components actually operate on the same value, both use this setter in their respective updates - this was the actual original implementation concern, i.e. do we need to maintain 2 separate values and combine them.

Cloning for future-proofing though, since we are looking at different date-picker components already due to the obtrusive nature of the current "standard" ones.

@ngotchac ngotchac added A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. and removed A0-pleasereview 🤓 Pull request needs code review. labels Feb 15, 2017
@jacogr jacogr added A0-pleasereview 🤓 Pull request needs code review. and removed A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. labels Feb 15, 2017
@ngotchac ngotchac added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Feb 16, 2017
@jacogr jacogr merged commit c14ecef into master Feb 16, 2017
@jacogr jacogr deleted the jg-explicit-seconds branch February 16, 2017 12:47
jacogr added a commit that referenced this pull request Feb 16, 2017
* Explicitly set seconds/milli to 0

* Use condition time & block setters consistently

* Fix failing test

* test for 0 ms & sec

* It cannot hurt, clone date before setting

* Prettier date test constants (OCD)
gavofyork pushed a commit that referenced this pull request Feb 16, 2017
* Explicitly set seconds/milli to 0

* Use condition time & block setters consistently

* Fix failing test

* test for 0 ms & sec

* It cannot hurt, clone date before setting

* Prettier date test constants (OCD)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants