<commit_before>'use strict';

angular.module('momentjs',[])
  .factory('moment',['$window',function($window){
      var moment = $window.moment;
      moment.getLastRunAction = function(pipelineRun) {
          if (pipelineRun.endTime == undefined) {
              return;
          }
          var result = {};
          var runEndTime = pipelineRun.endTime;
          var delta = moment(runEndTime);
          var now = moment();
          var diff = moment.duration(moment(now).diff(moment(delta))).humanize();
          if(diff == 'a few seconds'){
              diff = 'few seconds ago';
              result.output = diff;
          } else {
              result.output = diff + " ago";
          }
          return result;
      };

      return moment;
  }]);<commit_msg>Added logic for converting utc time in local #232<commit_after>'use strict';

angular.module('momentjs', [])
    .factory('moment', ['$window', function($window) {
        var moment = $window.moment;
        moment.getLastRunAction = function(pipelineRun) {
            if (pipelineRun.endTime == undefined) {
                return;
            }
            var result = {};
            var endDay = pipelineRun.endTime.date;
            var endTime = pipelineRun.endTime.time;
            var runEndTime = pipelineRun.endTime;
            debugger;
            var time = moment.utc({
                year: endDay.year,
                month: endDay.month,
                day: endDay.day,
                hour: endTime.hour,
                minute: endTime.minute,
                second: endTime.second
            });
            //date is in UTC. 3 hours back. To be in local we add 3 hours. We also add 1 month, because JS months in date are -1.[arrays count]
            // time.add(3, 'h');
            time.local();
            time.subtract(1, 'M');
            var delta = moment(time);
            var now = moment();
            var diff = moment.duration(moment(now).diff(moment(delta))).humanize();
            var rawDiff = moment.duration(moment(now).diff(moment(delta)));
            if (rawDiff.hours() < 1) {
                diff = rawDiff.minutes() + ' minutes ago';
                result.output = diff;
            } else {
                result.output = diff + " ago";
            }
            return result;
        };

        moment.formatTimeInLocal = function(time) {
            var bufferTime = moment.utc(time);
            bufferTime.local();
            var result = {
              hour: bufferTime.hours(),
              minute:bufferTime.minutes(),
              second:bufferTime.seconds()
            };
            return result;
        };
      
        return moment;
    }]);
{'fraction_non_alphanumeric': 0.12097669256381798, 'fraction_numerical': 0.003699593044765076, 'mean_word_length': 1.5413533834586466, 'pattern_counts': {'":': 0, '<': 4, '<?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': '6610765', 'n_tokens_mistral': 722, 'n_tokens_neox': 698, 'n_words': 171}