<commit_before>var BaseCollection = require('collections/BaseCollection'),
    _ = require('lodash'),
    Promise = require('bluebird'),
    moment = require('moment'),
    Calendar = Backbone.Model;

module.exports = BaseCollection.extend({

    endpoint: '/api/v1/calendar',

    comparator: 'order',

    model: Calendar,

    initialize: function () {
    	this.fullCollection = new Backbone.Collection();

        this.on('sync', _.bind(function () {
            this.fullCollection.reset(this.models);
        }, this));
    },

    getBySlug: function (slug) {
        return this.fullCollection.findWhere({
            slug: slug
        });
    },

    searchByDate: function(date) {
        var searchDate = new Date(date);
        var momentDate = moment(searchDate);

        var filteredCollection = _.filter(this.fullCollection.models, function (data) {
            return moment(searchDate).isSame(data.get('date'));
        });

        this.reset(filteredCollection);
    }
});<commit_msg>fixing date search<commit_after>var BaseCollection = require('collections/BaseCollection'),
    _ = require('lodash'),
    Promise = require('bluebird'),
    moment = require('moment'),
    Calendar = Backbone.Model;

module.exports = BaseCollection.extend({

    endpoint: '/api/v1/calendar',

    comparator: 'order',

    model: Calendar,

    initialize: function () {
    	this.fullCollection = new Backbone.Collection();

        this.on('sync', _.bind(function () {
            this.fullCollection.reset(this.models);
        }, this));
    },

    getBySlug: function (slug) {
        return this.fullCollection.findWhere({
            slug: slug
        });
    },

    searchByDate: function(date) {
        var searchDate = new Date(date);

        var filteredCollection = _.filter(this.fullCollection.models, function (data) {
            var dateString = data.get('date');
            dateString = dateString.substring(0,10).split('-');
            dateString = dateString[1] + '-' + dateString[2] + '-' + dateString[0];
            
            var dataDate = new Date(dateString);
            
            return moment(searchDate).isSame(dataDate);
        });

        this.reset(filteredCollection);
    }
});
{'fraction_non_alphanumeric': 0.1387645478961504, 'fraction_numerical': 0.0035810205908683975, 'mean_word_length': 2.508634222919937, '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': '5516056', 'n_tokens_mistral': 635, 'n_tokens_neox': 609, 'n_words': 114}