<commit_before><commit_msg>added ISOChronology<commit_after>/*globals jodajs*/
jodajs.ISOChronology = (function () {
    var SECOND_IN_MILLIS = 1000,
        MINUTE_IN_MILLIS = 1000 * 60,
        HOUR_IN_MILLIS = 1000 * 60 * 60,
        DAY_IN_MILLIS = 1000 * 60 * 60 * 24,
        self;

    function dateWithField(init, field, value) {
        var d = new Date(init);
        d['setUTC' + field](value);
        return d;
    }

    function startOfYear(year) {
        return dateWithField(0, 'FullYear', year).getTime();
    }

    function withNormalizedDay(date, day) {
        var dayOfMonth = self.dayOfMonth.get(date);
        return new Date(date.getTime() - ((dayOfMonth < day) ? DAY_IN_MILLIS * dayOfMonth : 0));
    }

    self = {
        year: {
            get: function (date) {
                return date.getUTCFullYear();
            },
            set: function (date, year) {
                return withNormalizedDay(dateWithField(date, 'FullYear', year), self.dayOfMonth.get(date));
            },
            add: function (date, years) {
                return this.set(date, this.get(date) + years);
            }
        },
        monthOfYear: {
            get: function (date) {
                return date.getUTCMonth() + 1;
            },
            set: function (date, month) {
                return withNormalizedDay(dateWithField(date, 'Month', month - 1), self.dayOfMonth.get(date));
            }
        },
        dayOfMonth: {
            get: function (date) {
                return date.getUTCDate();
            },
            set: function (date, dayOfMonth) {
                return dateWithField(date, 'Date', dayOfMonth);
            }
        },
        dayOfWeek: {
            get: function (date) {
                var day = date.getUTCDay();
                return day === 0 ? 7 : day;
            },
            set: function (date, dayOfWeek) {
                return new Date(date.getTime() + (dayOfWeek - this.get(date)) * DAY_IN_MILLIS);
            }
        },
        dayOfYear: {
            get: function (date) {
                return 1 + Math.floor((date.getTime() - startOfYear(self.year.get(date))) / DAY_IN_MILLIS);
            },
            set: function (date, dayOfYear) {
                return new Date(self.dayOfMonth.set(self.monthOfYear.set(date, 1), 1).getTime() + (dayOfYear - 1) * DAY_IN_MILLIS);
            }
        },
        hourOfDay: {
            get: function (date) {
                return date.getUTCHours();
            },
            set: function (date, hourOfDay) {
                return dateWithField(date, 'Hours', hourOfDay);
            }
        },
        minuteOfHour: {
            get: function (date) {
                return date.getUTCMinutes();
            },
            set: function (date, minuteOfHour) {
                return dateWithField(date, 'Minutes', minuteOfHour);
            }
        },
        secondOfMinute: {
            get: function (date) {
                return date.getUTCSeconds();
            },
            set: function (date, secondOfMinute) {
                return dateWithField(date, 'Seconds', secondOfMinute);
            }
        },
        millisOfSecond: {
            get: function (date) {
                return date.getUTCMilliseconds();
            },
            set: function (date, millisOfSecond) {
                return dateWithField(date, 'Milliseconds', millisOfSecond);
            }
        },
        months: {
            add: function (date, months) {
                var d = new Date(date),
                    year = self.year.get(date),
                    month = self.monthOfYear.get(date) + months;
                if (month < 1 || month > 12) {
                    year += (month / 12);
                    month = months < 0 ? (12 - month % 12) : (month % 12);
                }
                d.setUTCFullYear(year);
                d.setUTCMonth(month - 1);
                return withNormalizedDay(d, self.dayOfMonth.get(date));
            }
        },
        weeks: {
            add: function (date, weeks) {
                return new Date(date.getTime() + weeks * 7 * DAY_IN_MILLIS);
            }
        },
        days: {
            add: function (date, days) {
                return new Date(date.getTime() + days * DAY_IN_MILLIS);
            }
        },
        hours: {
            add: function (date, hours) {
                return new Date(date.getTime() + hours * HOUR_IN_MILLIS);
            }
        },
        minutes: {
            add: function (date, minutes) {
                return new Date(date.getTime() + minutes * MINUTE_IN_MILLIS);
            }
        },
        seconds: {
            add: function (date, seconds) {
                return new Date(date.getTime() + seconds * SECOND_IN_MILLIS);
            }
        },
        millis: {
            add: function (date, millis) {
                return new Date(date.getTime() + millis);
            }
        }

    };

    return self;
}());
{'fraction_non_alphanumeric': 0.11839744867450668, 'fraction_numerical': 0.01036475981662348, 'mean_word_length': 1.3669811320754717, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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': '3908277', 'n_tokens_mistral': 1514, 'n_tokens_neox': 1421, 'n_words': 305}