I want to push ASP.NET Model DateTime
values into an array to be used within the Google Chart API. I get an error saying I'm missing an ')'
when I use the following:
var dates = [];
@foreach (var s in Model.Scores)
{
//it works fine here
@:dates.push(parseFloat(@s.Score));
//but causes an error here
@:dates.push(new Date(@s.Date));
}
I've also tried
@:dates.push(String(@s.Date));
and
@:dates.push(String(@s.Date.ToString()));
and
@:dates.push(String(@s.Date.Date));
When I pass it a number instead of a DateTime
it works fine:
@for (var i = 1; i <= Model.Scores.Count(); i++)
{
@:count.push(@i);
}