Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions src/odbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,18 +438,14 @@ Handle<Value> ODBC::GetColumnValue( SQLHSTMT hStmt, Column column,
//return Null();
}
else {
if (strptime((char *) buffer, "%Y-%m-%d %H:%M:%S", &timeInfo)) {
//a negative value means that mktime() should use timezone information
//and system databases to attempt to determine whether DST is in effect
//at the specified time.
timeInfo.tm_isdst = -1;

//return scope.Escape(Date::New(Isolate::GetCurrent(), (double(mktime(&timeInfo)) * 1000));
return scope.Escape(Nan::New<Date>(double(mktime(&timeInfo)) * 1000).ToLocalChecked());
}
else {
return scope.Escape(Nan::New((char *)buffer).ToLocalChecked());
}
char dateStr[64] = "new Date('";
char *endStr = "')";
strcat(dateStr, (char *)buffer);
strcat(dateStr, endStr);
Handle<String> source = String::NewFromUtf8(Isolate::GetCurrent(), dateStr);
Handle<Script> script = Script::Compile(source);
Handle<Value> result = script->Run();
return scope.Escape(result);
}
#else
struct tm timeInfo = {
Expand Down