<commit_before>function google_calendar_getdata(cfg, callback) {
    // load calendar data then use callback to send data
    $.getJSON(cfg.url, function(data) {
        var output = {
            title: data.feed.title.$t,
            events: []
        };
        
        output.last_updated = moment(new Date(data.feed.updated.$t)).format("M/D h:mm a");
        var itemCount = !!cfg.itemcount ? cfg.itemcount : 3;

        // only get future items, order by date ascending, and limit to itemCount
        var today = new Date(); today.setHours(0,0,0);

        output.events = _.first(
            _.sortBy(
                _.reduce(data.feed.entry, function(memo, entry) {
                    if(!!entry.gd$when && entry.gd$when.length > 0) {
                        var start = new Date(entry.gd$when[0].startTime + " 00:00");
                        var end = new Date(entry.gd$when[0].endTime + " 00:00");
                        if(today <= end) {
                            memo.push({
                                startDate: start,
                                date: moment(start).format("M/D") + (start == end ? "" : "-" + moment(end).format("M/D")),<commit_msg>google_calendar widget: fixed end date for all day events to not show as the following date<commit_after>function google_calendar_getdata(cfg, callback) {
    // load calendar data then use callback to send data
    $.getJSON(cfg.url, function(data) {
        var output = {
            title: data.feed.title.$t,
            events: []
        };
        
        output.last_updated = moment(new Date(data.feed.updated.$t)).format("M/D h:mm a");
        var itemCount = !!cfg.itemcount ? cfg.itemcount : 3;

        // only get future items, order by date ascending, and limit to itemCount
        var today = new Date(); today.setHours(0,0,0);

        output.events = _.first(
            _.sortBy(
                _.reduce(data.feed.entry, function(memo, entry) {
                    if(!!entry.gd$when && entry.gd$when.length > 0) {
                        var start = new Date(entry.gd$when[0].startTime + " 00:00");
                        var end = new Date(entry.gd$when[0].endTime + " 00:00");
                        if(end > start)
                            end.setDate(end.getDate()-1);
                        if(today <= end) {
                            memo.push({
                                startDate: start,
                                date: moment(start).format("M/D") + (start.getTime() == end.getTime() ? "" : "-" + moment(end).format("M/D")),
{'fraction_non_alphanumeric': 0.1359375, 'fraction_numerical': 0.012109375, 'mean_word_length': 1.5947315096251267, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '5880092', 'n_tokens_mistral': 748, 'n_tokens_neox': 710, 'n_words': 167}