Solved

MomentJS Check if date has occurred in past

Posted on 2014-10-24
1
1,776 Views
Last Modified: 2014-11-18
I'm trying to check if a date has occurred in the past using MomentJS

      var isToday = new Date();
      var meetingDate = moment(object["meetingdate"]);
      var weeklySubDays = moment().subtract('days', 7);
      var outCome = isToday + meetingDate > weeklySubDays;

Open in new window

0
Comment
Question by:brendanlefavre
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40402675
var meetingDate = moment(object["meetingdate"]);
var outCome = moment().diff(meetingDate,'day') > 7;

Open in new window


more infos :
http://momentjs.com/docs/#/displaying/difference/
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This video teaches users how to migrate an existing Wordpress website to a new domain.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question