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

initial time model - use plugins format

Open padmanabanravikumar opened this issue 7 years ago • 1 comments

Use bootstrap timepicker's getTime method to update timeModel, so it matches plugins value format.

padmanabanravikumar avatar Jul 10 '17 12:07 padmanabanravikumar

We don't need to consider 'showSeconds' option, actually timepicker plugin take cares of it when we call for this.timepicker.timepicker('setTime', date). to fix empty timeModel we can call for this.timeModel = this. timepicker.data('timepicker').getTime(); Yes i agree, In current version, even with showSeconds: false expression, timepicker display seconds. considering your solution I've got an issue, if we provide some default time to display while control initialization then the format timepicker displays was not correct, it displays something similar to 09:05: AM instead of 9:05 AM.

Instead of formatted string we can directly pass date object to setTime function. and we can get back formatted string from getTime function to bind our timeModel

Hope this helps!

On Tue, Jul 11, 2017 at 5:07 PM, impulsenok [email protected] wrote:

I've got an issue with this part of code. You should consider 'showSeconds' options value('false') when u call for this.timepicker.timepicker('setTime', date). In current version, even with showSeconds: false expression, timepicker display seconds. Only after value change(focus input etc), it take appropriate view.

Smthng similar to this:

const time = this.pad(hours) + ':' + this.pad(this.date.getMinutes()) + ':' + (this.timepickerOptions.showSeconds || this.timepickerOptions.showSeconds === undefined ? this.pad(this.date.getSeconds()) : '') + (this.timepickerOptions.showMeridian || this.timepickerOptions.showMeridian === undefined ? meridian : '');

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nkalinov/ng2-datetime/pull/173#issuecomment-314416872, or mute the thread https://github.com/notifications/unsubscribe-auth/AKvmGoXAHn3QJLYUC0s-Mabwpl-jHUJnks5sM16LgaJpZM4OSwNO .

-- Thanks & Regards, Ravikumar P Aveon Infotech Pvt Ltd Coimbatore.

padmanabanravikumar avatar Jul 12 '17 03:07 padmanabanravikumar