Skip to content

Commit

Permalink
fix: correct SmallDateTime upper bound range
Browse files Browse the repository at this point in the history
  • Loading branch information
rockymadden committed Apr 29, 2024
1 parent 2b21b12 commit baf0a3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/data-types/smalldatetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const SmallDateTime: DataType = {

if (year === 2079) {
// Month is 0-indexed, i.e. Jan = 0, Dec = 11
if (month > 4 || (month === 4 && date > 6)) {
if (month > 5 || (month === 5 && date > 6)) {
throw new TypeError('Out of range.');
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/data-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ describe('SmallDateTime', function() {
}, TypeError, 'Out of range.');

assert.throws(() => {
TYPES.SmallDateTime.validate(new Date('June 1, 2079'));
TYPES.SmallDateTime.validate(new Date('June 7, 2079'));
}, TypeError, 'Out of range.');
});
});
Expand Down

0 comments on commit baf0a3d

Please sign in to comment.