diff --git a/pages/src/assets/ts/renderers/resources.ts b/pages/src/assets/ts/renderers/resources.ts index 378c418..1c8a883 100644 --- a/pages/src/assets/ts/renderers/resources.ts +++ b/pages/src/assets/ts/renderers/resources.ts @@ -42,16 +42,31 @@ export async function renderResources(container: HTMLElement) { versions: Array.from(d.versions).sort(semver.rcompare), })); + const sortedSet = resVersionSet.reverse(); let rows = ''; - for (const item of resVersionSet.reverse()) { + for (let i = 0; i < sortedSet.length; i++) { + const item = sortedSet[i]!; + const nextItem = sortedSet[i + 1]; // Newest first - const dateStr = DateTime.fromISO(item.rsp.updatedAt).toFormat('yyyy/MM/dd HH:mm:ss'); + const currentDate = DateTime.fromISO(item.rsp.updatedAt); + const dateStr = currentDate.toFormat('yyyy/MM/dd HH:mm:ss'); + + const intervalStr = (() => { + if (nextItem) { + const nextDate = DateTime.fromISO(nextItem.rsp.updatedAt); + const diff = currentDate.diff(nextDate); + return diff.toFormat('dd:hh:mm:ss'); + } + return '-'; + })(); + const initialRes = item.rsp.rsp.resources.find((e: any) => e.name === 'initial'); const mainRes = item.rsp.rsp.resources.find((e: any) => e.name === 'main'); const isKick = JSON.parse(item.rsp.rsp.configs).kick_flag === true; rows += `