Skip to content

Conversation

@EmielH
Copy link

@EmielH EmielH commented Jun 27, 2017

I added a new parameter disableClick that allows the user to type in the datefield, instead of opening the datetimepicker once the field gets focus. This is best used in combination with a button that opens the datetimepicker. This mimics the way the md-datepicker works by default. See https://material.angularjs.org/latest/demo/datepicker

The input the user types in the field needs to conform to the format. I added a parser that converts the user input to a Date object. To prevent strange behaviour when parsing datetimes while the user is typing, I added a debounce to the input field. If the datetime isn't valid, the previously set datetime is kept.

The diff for the second half is a bit messy. The only thing I did is add if (!scope.disableClick) around the handler for onFocus and increase the indentation.

@hexadecy hexadecy self-requested a review June 28, 2017 04:41
@hexadecy
Copy link

I'm just not sure about the parameter name.
autoShowDialog : true (default)

@EmielH
Copy link
Author

EmielH commented Jun 28, 2017

That's probably a better name. Md-datepicker uses openOnFocus which could also be a good choice.

I've also been thinking about the debounce: maybe it's now impossible for the user of the component to specify a different debounce himself since I've hardcoded 500 ms. I haven't tested this yet, though.

@hexadecy hexadecy merged commit 3a7986c into beenote:gh-pages Jun 29, 2017
@hexadecy
Copy link

hexadecy commented Jun 29, 2017

  • Add a demo
  • Change parameter name
    Make debounce configurable

Copy link

@hexadecy hexadecy left a comment

Choose a reason for hiding this comment

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

good job

hexadecy added a commit that referenced this pull request Jun 29, 2017
@hexadecy
Copy link

I think the debounce is fine

@EmielH
Copy link
Author

EmielH commented Jun 30, 2017

Awesome. Thanks!

@hexadecy
Copy link

hexadecy commented Jul 7, 2017

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.

2 participants