<commit_before>define(['knockout', 'factory/calendar', 'mods/format'], function(ko, calfac, format) {

    var items = ko.observableArray([]);
    var breadcrumbitems = ko.observableArray([]);
    var freetext = "";
    var filterwithoutdates = "";
    var search = null;

    function update(pfreetext, pfilterwithoutdates, pdatebegin, pdateend, searchmethod) {
        freetext = pfreetext;
        filterwithoutdates = pfilterwithoutdates;
        search = searchmethod;

        var any = false;

        if (pdatebegin != null && pdateend != null) {

            var d1 = pdatebegin;
            var d2 = pdateend;
            var d1yyyy = "" + d1.getFullYear();
            var d2yyyy = "" + d2.getFullYear();

            if (
                    d1yyyy.substring(0, 3) == d2yyyy.substring(0, 3) &&
                    d1yyyy.slice(-1) == "0" && d2yyyy.slice(-1) == "9"
                    ) {

                any = true;
                doyears(d1.getFullYear());
            }
            else if (d1yyyy == d2yyyy && d1.getMonth() != d2.getMonth()) {
                any = true;
                domonths(d1.getFullYear());
            }
            else if (d1yyyy == d2yyyy && d1.getMonth() == d2.getMonth()) {
                any = true;
                dodays(d1.getFullYear(), d1.getMonth());
            }

            generateBreadcrumb(format.getQueryDateStr(pdatebegin), format.getQueryDateStr(pdateend));
        }

        if (!any) {
            dodecades();
        }

    }

    function dodecades() {
        items.removeAll();
        breadcrumbitems.removeAll();
        addBreadcrumbDecades(true);

        var yearb = 1920;
        var yeare = (new Date().getFullYear()) / 10 * 10;

        for (var i = yearb; i < yeare; i += 10) {
            var item = getCalItem_decade(i);
            items.push(item);
            item.load(freetext, filterwithoutdates);
        }
    }

    function getCalItem_decade(decade) {
        var item = new calfac.CalendarItem();
        item.search = itemclick;
        item.title(decade + "'erne");
        item.datebegin(decade + "-01-01");
        item.dateend(decade + 9 + "-12-31");
        return item;
    }
<commit_msg>Fixed decade issue.<commit_after>define(['knockout', 'factory/calendar', 'mods/format'], function(ko, calfac, format) {

    var items = ko.observableArray([]);
    var breadcrumbitems = ko.observableArray([]);
    var freetext = "";
    var filterwithoutdates = "";
    var search = null;

    function update(pfreetext, pfilterwithoutdates, pdatebegin, pdateend, searchmethod) {
        freetext = pfreetext;
        filterwithoutdates = pfilterwithoutdates;
        search = searchmethod;

        var any = false;

        if (pdatebegin != null && pdateend != null) {

            var d1 = pdatebegin;
            var d2 = pdateend;
            var d1yyyy = "" + d1.getFullYear();
            var d2yyyy = "" + d2.getFullYear();

            if (
                    d1yyyy.substring(0, 3) == d2yyyy.substring(0, 3) &&
                    d1yyyy.slice(-1) == "0" && d2yyyy.slice(-1) == "9"
                    ) {

                any = true;
                doyears(d1.getFullYear());
            }
            else if (d1yyyy == d2yyyy && d1.getMonth() != d2.getMonth()) {
                any = true;
                domonths(d1.getFullYear());
            }
            else if (d1yyyy == d2yyyy && d1.getMonth() == d2.getMonth()) {
                any = true;
                dodays(d1.getFullYear(), d1.getMonth());
            }

            generateBreadcrumb(format.getQueryDateStr(pdatebegin), format.getQueryDateStr(pdateend));
        }

        if (!any) {
            dodecades();
        }

    }

    function dodecades() {
        items.removeAll();
        breadcrumbitems.removeAll();
        addBreadcrumbDecades(true);

        var yearb = 1920;
        var yeare = (new Date().getFullYear()) / 10 * 10;

        for (var i = yearb; i < yeare; i += 10) {
            var item = getCalItem_decade(i);
            items.push(item);
            item.load(freetext, filterwithoutdates);
        }
    }

    function getCalItem_decade(decade) {
        var item = new calfac.CalendarItem();
        item.search = itemclick;
        item.title(decade + "'erne");
        item.datebegin(decade + "-01-01");
        item.dateend((""+decade).substring(0,3) + 9 + "-12-31");
        return item;
    }

{'fraction_non_alphanumeric': 0.1360544217687075, 'fraction_numerical': 0.022675736961451247, 'mean_word_length': 1.7414543194530765, 'pattern_counts': {'":': 0, '<': 5, '<?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': '241245', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1351, 'n_words': 266}