Skip to content

Commit fd3c32f

Browse files
committed
Fix default date used for time columns
When a time column is retrieved and converted to a Date object, SQL Server's default date of 1900-1-1 is substituted for the missing components since time columns don't have a date. However, the constants being used for this were erroneously using JS default of 0 as the month rather than 1, the SQL Server default. This affected the conversion process and caused certain dates to be returned incorrectly. Microsoft Internal Review Id jaykint-43ad01c968244ab6a5481cb64ac7d06f
1 parent d6e26d3 commit fd3c32f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/stdafx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
// There is no default JS date when only a time is furnished, so we are using the SQL Server
4747
// defaults, which is Jan 1, 1900.
4848
const int SQL_SERVER_DEFAULT_YEAR = 1900;
49-
const int SQL_SERVER_DEFAULT_MONTH = 0; // JS months are 0 based
49+
const int SQL_SERVER_DEFAULT_MONTH = 1; // JS months are 0 based, SQL Server months are 1 based
5050
const int SQL_SERVER_DEFAULT_DAY = 1;
5151

5252
#define ErrorIf(x) if (x) goto Error;

0 commit comments

Comments
 (0)