Here you can find the source of before(other)
Date.prototype.before = function(other) { return this.compareTo(other) < 0; }; Date.prototype.after = function(other) { return this.compareTo(other) > 0; }; Date.prototype.withDate = function(date) { this.setFullYear(date.getFullYear()); this.setMonth(date.getMonth());// ww w .ja v a 2 s . com this.setDate(date.getDate()); return this; }; Date.prototype.withTodaysDate = function(date) { return this.withDate(new Date()); }; function day(date) { var startOfEvent = new Date(2014, 10, 10); var theDay = date == undefined ? Date.today() : date; var diff = (theDay.getDayOfYear() + 1) - startOfEvent.getDayOfYear(); var eventDay = diff >= 1 && diff <= 5 ? diff : 1; // Default to day1 to show something console.log('Calculated event day: ', eventDay); return eventDay; }
Date.prototype.before = function(other) { return this.compareTo(other) < 0;
Date.prototype.isBefore = function(date2) return this < date2
Date.prototype.isBeforeDate = function (d) { var tDate = new Date(this.getFullYear(), this.getMonth(), this.getDate()); var pDate = new Date(d.getFullYear(), d.getMonth(), d.getDate()); return tDate < pDate