@gpc-cli/core 0.9.25 → 0.9.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4189,13 +4189,22 @@ function formatTrend(current, previous) {
4189
4189
  if (current < previous) return ` \u2193 from ${previous.toFixed(1)}`;
4190
4190
  return "";
4191
4191
  }
4192
+ function relativeTime(isoString) {
4193
+ const diffMs = Date.now() - new Date(isoString).getTime();
4194
+ const diffMin = Math.floor(diffMs / 6e4);
4195
+ if (diffMin < 1) return "just now";
4196
+ if (diffMin < 60) return `${diffMin} min ago`;
4197
+ const diffHr = Math.floor(diffMin / 60);
4198
+ if (diffHr < 24) return `${diffHr}h ago`;
4199
+ return `${Math.floor(diffHr / 24)}d ago`;
4200
+ }
4192
4201
  function allVitalsUnknown(vitals) {
4193
4202
  return vitals.crashes.status === "unknown" && vitals.anr.status === "unknown" && vitals.slowStarts.status === "unknown" && vitals.slowRender.status === "unknown";
4194
4203
  }
4195
4204
  function formatStatusTable(status) {
4196
4205
  const lines = [];
4197
4206
  const sectionSet = new Set(status.sections);
4198
- const cachedLabel = status.cached ? ` (cached ${new Date(status.fetchedAt).toLocaleTimeString()})` : ` (fetched ${new Date(status.fetchedAt).toLocaleTimeString()})`;
4207
+ const cachedLabel = status.cached ? ` (cached ${relativeTime(status.fetchedAt)})` : ` (fetched ${relativeTime(status.fetchedAt)})`;
4199
4208
  lines.push(`App: ${status.packageName}${cachedLabel}`);
4200
4209
  if (sectionSet.has("releases")) {
4201
4210
  lines.push("");