add days to Date

Hi All,

Has anybody ever used moment before? http://momentjs.com/

It seems like an easy way to manipulate dates.
I am trying to add days to a date I get from a sharePoint list but it's not working like I expect.
i think my syntax is wrong and I can't find anything on their site about how to do this.

function getCumuVal(dte)
{
	alert(dte);
	var nextDate = moment().add('days', 6).calendar(dte);
	alert("nxDte: "+nextDate);
}

Open in new window


The first alert shows the date being passed in but then the 2nd alert shows this..
"nxDte: Thursday at 11:17 AM".
It shows that for all the dates.

When I tried it this way
var nextDate = moment(dte).add('days', 6);

Open in new window

My alert produced the folllwoing: "1349841600000" but the values were different for each date


Any ideas or how I can add 6 days to any date?

Thanks!
LVL 5
IsaacSharePoint Client Side DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
try this :
function getCumuVal(dte)
{
	alert(dte);
	var nextDate = moment(dte).add('days', 6).calendar();
	alert("nxDte: "+nextDate);
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IsaacSharePoint Client Side DeveloperAuthor Commented:
Excellent!!!

Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.