For now I written such a workaround. It is more correct to use env->context() instead of v8::Isolate::GetCurrent(), but napi_env is defined in src/js_native_api_v8.h, which does not exist in ~/.node-gyp/10.15.3/include/node, so I did not find a fast way to use env->context().
#include
// This asserts v8::Local<> will always be implemented with a single
// pointer field so that we can pass it around as a void*.
static_assert(sizeof(v8::Local) == sizeof(napi_value),
"Cannot convert between v8::Local and napi_value");
napi_status napi_create_date_by_v8(
double time,
napi_value* result
) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::MaybeLocal maybe_date = v8::Date::New(isolate, time);
v8::Local local = maybe_date.ToLocalChecked();
*result = reinterpret_cast(*local);
return napi_ok;
}