mgcrea / angular-strap

AngularJS 1.2+ native directives for Bootstrap 3.
mgcrea.github.io/angular-strap
MIT License
5.73k stars 1.38k forks source link

This type of constructor of Date drops milliseconds on IE 11.611.16299.0 #2278

Closed sandipchitale closed 5 years ago

sandipchitale commented 6 years ago

https://github.com/mgcrea/angular-strap/blob/6422662368d3eadbfea1506efee55c5d843946d2/dist/modules/timepicker.js#L452

Try this short script in IE Devtools Console:

var now = new Date();
console.log(now + ‘ has milliseconds: ’ + now.getMilliseconds())
var nowDate = new Date(now);
console.log(nowDate  +  ‘ has milliseconds: ’ +  nowDate.getMilliseconds())

You will get something like:

Thu Sep 13 2018 14:04:42 GMT-0700 (Pacific Daylight Time) has milliseconds: 477
Thu Sep 13 2018 14:04:42 GMT-0700 (Pacific Daylight Time) has milliseconds: 0
sandipchitale commented 6 years ago

Suggest using:

new Date(year, monthIndex [, day [, hours [, minutes [, seconds [, milliseconds]]]]]);

style constructor instead.

sandipchitale commented 6 years ago

Or

new Date(date.getTime())

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.