momentJS date string add 5 days

UPDATED: January 19, 2016 As of moment 2.8.4 – use .add(5, ‘d’) (or .add(5, ‘days’)) instead of .add(‘d’, 5) Thanks @Bala for the information. UPDATED: March 21, 2014 This is what you’d have to do to get that format. Here’s an updated fiddle ORIGINAL: March 20, 2014 You’re not telling it how/what unit to add. Use –

Moment Js UTC to Local Time

I’m trying to convert UTC time to the local time. I’ve been following this example from this link: http://jsfiddle.net/FLhpq/4/light/. I can’t seem to get the right local output. For example, if its 10: 30 am in here, instead of getting 10:30 ill get 15: 30. Here is my code: No matter what I do the … Read more

Reference Error: moment is not defined (Using moment.js)

I installed the moment.js library and was about to play around with it a little bit, when i got this error. I’ve tried many different things, but nothing has worked. Any ideas? I have a folder that i’ve installed moment.js into (npm install moment) and i’m running my program (node isDate.js). ReferenceError: moment is not … Read more

Moment js date time comparison

I believe you are looking for the query functions, isBefore, isSame, and isAfter. But it’s a bit difficult to tell exactly what you’re attempting. Perhaps you are just looking to get the difference between the input time and the current time? If so, consider the difference function, diff. For example: A few other things: There’s an error in the first line: … Read more