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

Not working if apply date-format attribute

Open SharmaHarsh7 opened this issue 8 years ago • 5 comments

Hi,

I am using this control in my angular2 application which is based on reactive form approach.

It is working fine when I used the default code as mentioned on your plunker but when I apply date-format attribute it is not showing anything in the text box.

It is showing calendar and allowing me to change the date but the date is not in being display in the text box.

Thanks, Harsh

SharmaHarsh7 avatar Apr 24 '17 11:04 SharmaHarsh7

Please create a plunker example for this. Without a reproducible example, it's hard to tackle the problem.

allenhwkim avatar Apr 25 '17 16:04 allenhwkim

It is working fine with plunker but giving error on my machine when I follow the exact same steps mention by you on GIT and in Plunker.

Following is the code I am using: image

And this is the error: image

Also If I apply date-format attribute, everything goes fine but I don't see any update in the model bind to the control. Apply the code: image

Selected a date: image

The control is blank: image

It looks like the plunker and the steps you provided on GIT are outdated and not updated to the latest version on the control.

Could you please suggest any way to get rid of this issue.

Thanks. Harsh

SharmaHarsh7 avatar Apr 26 '17 03:04 SharmaHarsh7

i am also getting same issue while setting date-format..

rojarohini avatar May 06 '17 09:05 rojarohini

Same thing happening for me, the value of the datetime field becomes null on applying the date-format attribute. (Using moment.js, the parse-format attribute is working fine though)

aksdhaon avatar May 17 '17 13:05 aksdhaon

I was facing this issue and it appears to be a bug with NPM not including moment.locale This is why it works in Plunkr, because you are using the CDN

My fix was to directly require("moment/min/locales.min") in my app.module.ts

Hope this helps someone

ghost avatar May 23 '17 15:05 ghost