Repository navigation
fix: datetime max millisecond issue - #762
Conversation
|
Looks good. Can you add a test too? Under \test\integration\datatypes-in-resultset, maybe? |
| threeHundredthsOfSecond = milliseconds / (3 + (1 / 3)); | ||
| threeHundredthsOfSecond = Math.round(threeHundredthsOfSecond); | ||
| // 25920000 equals one day | ||
| if (threeHundredthsOfSecond === 25920000) { |
There was a problem hiding this comment.
Is this the maximum value threeHundredthsOfSecond can have?
There was a problem hiding this comment.
according to TDS
One 4-byte signed integer that represents the number of days since January 1, 1900. Negative numbers are allowed to represent dates since January 1, 1753.
One 4-byte unsigned integer that represents the number of one three-hundredths of a second (300 counts per second) elapsed since 12 AM that day
the buffer consists of days/threehundredth of a second, 25920000 equals to a full day and if we hit it, we should increment the day
|
Is this fix "correct"? According to #524, this failure might be due to a bug in SQL Server itself? |
|
@arthurschreiber it makes sense since the number of days and time are sent separately, so if the time is full 24 hrs then it should change the day. this fixed the two tests mentioned in #524 |
|
Hi @arthurschreiber, I have looked into this issue and I think this is a valid and important fix. However, I think we can still add some extra comments to make it more clear. As the comment on line 40, we could add some extra explanation to clear things up: In addition, I think we can add some comments above line 38 to just explain the expression: milliseconds / (3 + (1 / 3)). I just want to confirm with you first that I understand this correctly. Is this expression equivalent to "milliseconds /1000 * 300"? I understand this as convert millisecond number back to seconds by divided it by 1000 and count the "one three-hundredths of a second" by dividing it with 300. If this is correct, is it better for us to add some comment here to explain this? Is it possible for you to help add the comments to this PR, or I can create a new PR and you can close this one? |
|
Any movement on this? This just bit my ass passing in an end-of-day value. Basically any time you try to do an outer limit of 23:59:59.999 in a where clause it'll explode on you. Came here to submit the issue and it looks like this is the exact same one. |
4a1d2ac to
b246b56
Compare
Codecov Report
@@ Coverage Diff @@
## master #762 +/- ##
==========================================
+ Coverage 77.61% 77.62% +0.01%
==========================================
Files 86 86
Lines 4230 4233 +3
Branches 779 780 +1
==========================================
+ Hits 3283 3286 +3
Misses 675 675
Partials 272 272
Continue to review full report at Codecov.
|
|
Thank you very much for preparing this @Hadis-Fard, sorry this has taken so long to get merged! 🙇 |
|
🎉 This PR is included in version 6.6.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Datetime round millisecond in nearest .xx3, .xx7, .xx0, when the ms is rounded to 000 in case of 23:59:59:999, day should be incremented. the issue manifest itself in useUTC true or false
Fixes: #755