Skip to content

frontend: align duration formatting with apimachinery logic#4931

Open
ChayanDass wants to merge 1 commit intokubernetes-sigs:mainfrom
ChayanDass:duration/format
Open

frontend: align duration formatting with apimachinery logic#4931
ChayanDass wants to merge 1 commit intokubernetes-sigs:mainfrom
ChayanDass:duration/format

Conversation

@ChayanDass
Copy link
Contributor

Summary

Align frontend duration/age formatting with Kubernetes apimachinery behavior.

Related Issue

Fixes headlamp-k8s/plugins#485 -> duration issue

Changes

  • Replaced humanize-duration based age formatting in frontend/src/lib/util.ts.
  • Implemented Kubernetes-style logic equivalent to:
    • ShortHumanDuration for compact age values.
    • HumanDuration for slightly more detailed duration values.
  • Updated formatDuration() to use the new internal formatter functions.

Why

This makes Age/Duration output consistent with Kubernetes conventions and avoids mismatches in relative time rendering.

Steps to Test

  1. Open resource list views that show Age (for example Pods, Deployments, Jobs).
  2. Verify compact age values render in Kubernetes-like format (s, m, h, d, y).
  3. Check places using mini/expanded duration formatting still display correctly.

Screenshots

image

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ChayanDass
Once this PR has been reviewed and has the lgtm label, please assign illume for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 21, 2026
…ogic

Replace frontend duration formatting with Kubernetes apimachinery-style ShortHumanDuration and HumanDuration behavior for age-related displays.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cluster API Headlamp CAPI project - Linux Foundation paid mentorship project

2 participants