unmade / am-date-picker

angular material date picker
MIT License
21 stars 13 forks source link

Dialog 'OK' doesn't select a date #9

Closed SirDarquan closed 8 years ago

SirDarquan commented 8 years ago

So this feel really unintuitive to me. If I press the 'OK' button, I'm saying that I want the current value to set. Yet, if I start of with a picker that doesn't have a date already set, 'OK' will remain in that state. To me the purpose of the date picker is to pick a date. What do think of just disabling the 'OK' button if where is no selected date. The user will be forced to cancel if they still don't want to select a date.

unmade commented 8 years ago

I like logic of the 'OK' button as it is now in the master branch. If there is no selected date and you press 'OK', then nothing happens (why something should have happened if nothing was picked). To pick the current date you have the 'Today' button. I really don't know what's misleading or unintuitive in this behavior. I think it's more about tastes, but from my user experience, I'd like this logic.

As for disabling the 'OK' button, what will happen if you click outside instead of 'Cancel' button?

SirDarquan commented 8 years ago

I was thinking about it in more of a form validation scenario. If the form is invalid, we don't allow it to save. No date selected is 'invalid' for a date picker. So allowing someone to select an invalid value defeats the purpose of the component. 'OK' should be the confirmation that a value value is getting selected. Therefore, if the value IS invalid, the the 'OK' button should be disabled. Even if the 'OK' button is disabled, the Cancel button and clicking outside the dialog box will still work and leave the value in the invalid state.

I respect your desire to leave it working the way it currently does. Just giving my opinion on how I was expecting to use it.

FlipOneDev commented 8 years ago

@unmade - @SirDarquan's 'opinion' does mirror what I need, which is to attach a handler function to the OK button, which when pressed, signifies that the user confirms any date value selection. Whether the value is valid or not can be handled by the OK button event handler function.

Does that make sense somehow?

unmade commented 8 years ago

Well, now it does.