Can someone give me a hand...
I need a simple function, given a day of the week - and a number, to do
queries like "is this the 3rd Monday of the month" - returning true or
false.
I thought I had it here but it is returning false regardless. Can anyone
spot what's wrong?
function dayinmonth(weekday,n)
{
var date=new Date();
if (n > 0)
{
var first = new Date(date.Year, date.Month, 1);
return ((date.Day - first.Day)/ 7 == n - 1) && (date.DayOfWeek
== weekday);
}
else
{
var last = new Date(date.Year, date.Month,
1).AddMonths(1).AddDays(-1);
return ((last.Day - date.Day) / 7 == (Math.Abs(n) - 1)) &&
(date.DayOfWeek == weekday);
}
}
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/9d12e4d5-acb8-4ba0-979f-55d6feb9b130%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.