valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.52k stars 1.7k forks source link

If datetiepicker used along with ngModel it replaces the initial input date with current date. #6260

Open mukuljai opened 2 years ago

mukuljai commented 2 years ago

@daniloff200 this change https://github.com/valor-software/ngx-bootstrap/pull/5701 is actually causing issue where if datetiepicker used along with ngModel it replaces the initial input date with current date. To pin point the issue in code here -

if (!this._bsValue && value) {
      const now = new Date();

Why need to have current date fixed in lib, why it cant be provided as input if required?

Originally posted by @mukuljai in https://github.com/valor-software/ngx-bootstrap/issues/5701#issuecomment-895272330

nielswitte commented 2 years ago

I am facing a similar issue where multiple datepicker are used and after changing one date, alle the hours, minutes, seconds of the other dates are set to now (the moment of initializing the datepicker). All Date objects have midnight UTC as time (hours, minutes, seconds all 0) on initializing the form, but after one change, alle hours, minutes and seconds are replaced.