Hello,
I'm trying to create/parse date from a JS evaluate and return them as strings back into c# code as such:
```
using (var engine = new V8ScriptEngine())
{
resultEval = engine.Evaluate(expression);
}
```
where my `expression` is
`new Date()`
and it return an "Microsoft.ClearScript.V8.V8ScriptItem" object with an "UnderlyingSystemType" saying:
'((Microsoft.ClearScript.ScriptItem)resultEval).UnderlyingSystemType' threw an exception of type 'System.NotImplementedException'
Now, I feel like this *should* work, but it's not. Any ideas? I don't think anything went wrong during the build/reference process. Other JS libraries such as Math work flawlessly.
Also, this is only an issue when trying to create a `new` date. Calling `Date()` works, but it only displays today's date.
Comments: Hi, thanks for taking the time to answer. We have a web application and want to have a scripting interface for the user where they can manipulate and compare dates (as well as do any other scripting) as they would easily be able in VBS with DateAdd(). Now, I understand you can't flat out return a JavaScript `Date` object into .NET and expect it to work, so the issue is with the return type. But then why does `Date()` work? Is it implementing DateTime.Now? I think that's a bit confusing. After thinking about this, it does seem that JS `Date()` directly returns a string, which would explain this behaviour. What I was expecting to return would be a string (that we could convert into DateTime when back in .NET), or a DateTime object. It looks like I'll have to instruct users to use .toString() instead of returning the JavaScript `Date` object directly. Thanks.
I'm trying to create/parse date from a JS evaluate and return them as strings back into c# code as such:
```
using (var engine = new V8ScriptEngine())
{
resultEval = engine.Evaluate(expression);
}
```
where my `expression` is
`new Date()`
and it return an "Microsoft.ClearScript.V8.V8ScriptItem" object with an "UnderlyingSystemType" saying:
'((Microsoft.ClearScript.ScriptItem)resultEval).UnderlyingSystemType' threw an exception of type 'System.NotImplementedException'
Now, I feel like this *should* work, but it's not. Any ideas? I don't think anything went wrong during the build/reference process. Other JS libraries such as Math work flawlessly.
Also, this is only an issue when trying to create a `new` date. Calling `Date()` works, but it only displays today's date.
Comments: Hi, thanks for taking the time to answer. We have a web application and want to have a scripting interface for the user where they can manipulate and compare dates (as well as do any other scripting) as they would easily be able in VBS with DateAdd(). Now, I understand you can't flat out return a JavaScript `Date` object into .NET and expect it to work, so the issue is with the return type. But then why does `Date()` work? Is it implementing DateTime.Now? I think that's a bit confusing. After thinking about this, it does seem that JS `Date()` directly returns a string, which would explain this behaviour. What I was expecting to return would be a string (that we could convert into DateTime when back in .NET), or a DateTime object. It looks like I'll have to instruct users to use .toString() instead of returning the JavaScript `Date` object directly. Thanks.