Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime millisecond precision #391

Closed
symi opened this issue May 28, 2016 · 1 comment
Closed

DateTime millisecond precision #391

symi opened this issue May 28, 2016 · 1 comment

Comments

@symi
Copy link

symi commented May 28, 2016

I've noticed the DateTime millisecond precision seems to be losing the thousandth of a second figure. If I create a param (for a stored sproc request), with type DateTime and set the value to be 2016-05-27 11:05:06.763 (as a JS Date object). The actual value present in sqlserver seems to be 2016-05-27 11:05:06.760.

I've tracked it down to this code in data-type.js

threeHundredthsOfSecond = milliseconds / (3 + (1 / 3));
threeHundredthsOfSecond = Math.floor(threeHundredthsOfSecond);

I assume this has something to do with the 3 millisecond precision of DateTime ( .000, .003, or .007) however it shouldn't be rounding 003 to 000.

As a quick fix I've changed Math.floor to Math.round see commit on my fork which seems to work... however I'm no expert in this area and not 100% sure if it's the correct fix, so waiting on advice before PR'ing.

@frikkievb
Copy link

I've tried your suggestion but with no success. Also struggling with this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants