Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

feat(timepicker): added ability to clear timepicker control #5299

Closed
wants to merge 1 commit into from

Conversation

asurinov
Copy link
Contributor

Closes #5293

@asurinov asurinov changed the title feat(timepicker): add ability to clear timepicker control feat(timepicker): added ability to clear timepicker control Jan 19, 2016
@wesleycho
Copy link
Contributor

@Foxandxss what is your thoughts? I'm a little wary since this is a breaking change with UX ramifications.

Perhaps this should be hidden behind a config flag to prevent it from becoming a breaking change.

@@ -464,6 +474,12 @@ angular.module('ui.bootstrap.timepicker', [])
return newDate;
}

function modelIsEmpty(){
Copy link
Contributor

Choose a reason for hiding this comment

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

Add space before {.

@@ -165,7 +165,7 @@ angular.module('ui.bootstrap.timepicker', [])
var hours = +$scope.hours;
var valid = $scope.showMeridian ? hours > 0 && hours < 13 :
hours >= 0 && hours < 24;
if (!valid) {
if (!valid || $scope.hours === '') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a tip, the empty string is falsey so this and all your other checks of this nature can be simplified.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine - valid is a boolean, as can be seen from the two lines prior. I did do a double take too, but it checks out.

Copy link
Contributor

Choose a reason for hiding this comment

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

ahhh. thanks.

@icfantv
Copy link
Contributor

icfantv commented Jan 19, 2016

On one hand, I'm ok with this being a BC behind an optional config flag. On the other, we talk about API bloat. I'm on mobile right now so I can't look closely enough, but what if we let the user optionally specify their own validation function so it's totally up to them?

@asurinov
Copy link
Contributor Author

I think it's a normal behavior of any control to have an empty state and this state must be valid

@icfantv
Copy link
Contributor

icfantv commented Jan 19, 2016

@asurinov, while I tend to agree with that statement, we still need to balance feature vs. usability. there is such a thing as too much control and if a component gets to that point, it becomes unwieldy and confusing and actually creates more problems than it solves. See the datepicker for what I mean.

@wesleycho
Copy link
Contributor

After letting this sit a little while, I'm ok with this breaking change.

This PR LGTM - the only question left now is when should we schedule this change - 1.2.3 or 1.3.0?

@asurinov
Copy link
Contributor Author

So when will it be merged?

@icfantv
Copy link
Contributor

icfantv commented Mar 23, 2016

@asurinov, please remember we are all unpaid volunteers. while i understand and can appreciate some level of impatience, please be a little more discerning with your word choice. we'll get this merged.

@wesleycho wesleycho added this to the 1.3.0 milestone Mar 23, 2016
@wesleycho
Copy link
Contributor

There was some objection by @Foxandxss on this PR, as to this particular feature, which is the primary reason for holding up this being merged.

@Foxandxss
Copy link
Contributor

I just don't like breaking changes for such feature, but also don't bloat the API. So I am not entirely sure but I don't mind it either.

@wesleycho
Copy link
Contributor

Alright, then I'll merge it - one could write a directive with an appropriate $parser/$formatter if one wants the previous behavior.

@wesleycho wesleycho closed this in 449c0d1 Mar 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants