I have the following JavaScript function to determine if a given date
is the last day of the month:
function isLastDayOfMonth(date) {
var parts = date.split(' ');
var mo = parts[0];
var month = parseInt(parts[0]);
var day = parseInt(parts[1]);
var year = parseInt(parts[2]);
if (day == @DateTime.DaysInMonth(year, month)) {
return true;
}
return false;
}
VisualStudio shows a syntax error, that year
and month
cannot be found in the current context (in the function call of DaysInMonth
. I tried messing with the @
, because I'm not sure what that's doing, to no avail. Visual Studio suggests that I start the parameter for DaysInMonth
as: year:
then I assume something else, but I'm not sure what. Can anyone help?