JSFiddle - React, Tailwind, and code Playground

JavaScript

var i, 
    result,
    current,
    propCounter,
    content = { "name":"5-HP-N/A-N/A-F8", "node":{ "name":"5", "id":14 }, "timeline":{ "epc":null, "m1":null, "m2":null, "m3":1554087600000, "m4":1593572400000, "m5":1625108400000, "m6":1641006000000, "m7":1656644400000 }, "fab":{ "name":"F8", "id":1 } },
    
    
    // get the milestone in a function
    getMileStone = function(obj) {
      propCounter = 1;
        for(propCounter = 1; propCounter <= 7; propCounter++) {
            if(obj.timeline["m" + propCounter]) {
                return {key: "m" + propCounter, value: obj.timeline["m" + propCounter]};
            }
        }
    };


  firstMileStone = getMileStone(content); 
  result = {
      'start': new Date(content.epc || firstMileStone.value),
      'end': new Date(content.m1 || firstMileStone.value),
      'content': firstMileStone.key,
      'group' : content.name,
      'classname' : firstMileStone.value
   };


  alert(JSON.stringify(result, null, 2));