ng2-datetime icon indicating copy to clipboard operation
ng2-datetime copied to clipboard

fix ng2-datetime not working in Angular Material

Open dangviettuan opened this issue 8 years ago • 2 comments

dangviettuan avatar Aug 10 '17 04:08 dangviettuan

Please do not accept this pull request. This basically undoes my changes from my pull request https://github.com/nkalinov/ng2-datetime/commit/07dfe0029ec33461ba13cf3887447833f13224b3 accepted 2 months ago that addressed the issues https://github.com/nkalinov/ng2-datetime/issues/166 and https://github.com/nkalinov/ng2-datetime/issues/170.

Besides that it hasn't been reviewed by @dangviettuan since it adds some console.log spam on line 184 and imposes code style changes for the sake of changing the code style (which has nothing to do with the reason of this pull request).

Also, parseInt's second argument should not be removed. Quoting https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt

If the input string begins with "0", radix is eight (octal) or 10 (decimal). Exactly which radix is chosen is implementation-dependent. ECMAScript 5 specifies that 10 (decimal) is used, but not all browsers support this yet. For this reason always specify a radix when using parseInt.

Adding to that, diverse linting tools will decline the lack of radix argument.

wartab avatar Aug 12 '17 01:08 wartab

This PR also adds some parameters showDate and showTime, also not described in the PR.

@dangviettuan Addressing your issue, you need to encapsulate the datetime-picker in your form-group and add form-inline to your form/div yourself. This component is supposed to be a form element, not a form.

wartab avatar Aug 12 '17 01:08 wartab