<commit_before>'use strict';

/**
 * Module dependencies.
 */

/**
 * Get the next instance of the recurring this after curDate
 */
exports.next = function(curDate) {
	return this;
};

exports.past = function(curDate) {
	return this;
};<commit_msg>Got weekly recurring events working<commit_after>'use strict';

/**
 * Module dependencies.
 */
var moment = require('moment');

/**
 * Get the next instance of the recurring this after curDate
 */
exports.next = function(curDate) {
	//console.log(curDate);
	var weekDays = this.recurring.params.days;
	var monthDate = moment(this.sched.start.getTime());
	var curDate = moment(curDate);
	var nextDate = moment(curDate).set({'hour': monthDate.hour(), 'minute': monthDate.minute(), 'second': 0});
	while(weekDays.indexOf(nextDate.day()) == -1 || nextDate.isBefore(curDate)) {
		nextDate.add(1, 'day');
	}
	var nDate = parseInt(nextDate.format('x'));
	return {
		_id: this._id,
		name: this.name,
		created: this.created,
		owner: this.owner,
		length: this.length,
		sched: {
			start: new Date(nDate),
			end: new Date(nDate + this.length)
		},
		status: this.status
	}
};

exports.past = function(curDate) {
	return this;
};
{'fraction_non_alphanumeric': 0.16296928327645052, 'fraction_numerical': 0.002559726962457338, 'mean_word_length': 4.236607142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5895374', 'n_tokens_mistral': 415, 'n_tokens_neox': 393, 'n_words': 96}