v8 Date in C++ Addon

41 views
Skip to first unread message

P. Venkatraman

unread,
Nov 10, 2014, 7:03:37 AM11/10/14
to nod...@googlegroups.com
I am working on C++ Addon and am trying to set the various DATE fields

CallDateMethod (date, "setUTCFullYear", year).;
CallDateMethod(date, "setUTCMonth", month);
CallDateMethod (date, "setUTCDate", date);
CallDateMethod (date, "setUTCHours", hours);
CallDateMethod (date, "setUTCMinutes", mins);
CallDateMethod (date, "setUTCSeconds", secs);

where the CallDateMethod is as follows:

void CallDateMethod (v8::Local::<v8::Date> date, const char *method, int v)
{
  Handle<Value> args[1];

  args[0] = v8::Number::New (v);
  Local<Function>::Cast (date->Get(String::New (method)))->Call (date, 1, args);
}


year, month, date, hours, mins, secs are good, have verified,

and printing this in js script, consistently shows a wrong value.

Any suggestion how to set values in v8::Date?

Thanks,
-P. Venkatraman.
Reply all
Reply to author
Forward
0 new messages