如何从 HAR 对象计算 Chrome DevTools 网络选项卡中显示的 'Finish' 时间?

How to calculate the 'Finish' time shown in Chrome DevTools Network tab from the HAR object?

我正在创建一个 Chrome 扩展。我从 DevTools 面板中检索了 HAR 对象。我能够从 HAR 对象中获取 'Load' 和 'DOMContentLoaded' 时间,

pages: [
  {
    "startedDateTime": "2019-03-07T22:16:02.333Z",
    "id": "page_2",
    "title": "https://xxxx",
    "pageTimings": {
      "onContentLoad": 1635.4740000006132,
      "onLoad": 2318.5020000000804
    }
  }
]

现在,我如何计算 HAR 对象的 'Finish' 时间,如下所示为 7.75 秒?

所以,我想通了,

FinishTime=(lastRequestStartedTime + lastRequestDuration) - (firstRequestStartedTime)

const requests=harObject.entries;

const lastRequest = requests.reduce(
    (a, b) => {
      return a.startedDateTime > b.startedDateTime ? a : b;
    }
  );

const firstRequest = requests.reduce(
    (a, b) => {
      return a.startedDateTime < b.startedDateTime ? a : b;
    }
  );

//Finish Time in Seconds
const finishTime=`((Date.parse(lastRequest.startedDateTime) + lastRequest.time
                  - Date.parse(firstRequest.startedDateTime))
                  / 1000).toFixed(2)