Jump to content

Logic Checking


chrisciscoioio
 Share

Recommended Posts

Hello,I have a function, and I just want to have the logic checked.This function checks to see when the next monday is, but if it is today then it sets the next monday to be a week from today.At least thats what I think it does.Can someone take a second look and make sure my logic is right.

function getNextMonday(){	var date = new Date();	var daysTilMonday;		for(i = 0; i < 8; i++)	{		if (i < 1) // Make sure it is not monday already		{			if (date.getDay() == 1)			{				daysTilMonday = 7;			}					}		else		{			if (date.getDay() == 1)			{				daysTilMonday = i;			}		}	}	return daysTilMonday;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...