Solved

MomentJS Check if date has occurred in past

Posted on 2014-10-24
1
1,162 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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

There is a huge demand for CodeIgniter among the PHP web developers due to its dynamic features and benefits these days. It is one of most popular and agile open source PHP framework for creating robust web applications in PHP web development field.…
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now