Skip to content

Update duration formatting to use Intl.DurationFormat#857

Merged
timja merged 6 commits intojenkinsci:mainfrom
lewisbirks:duration-format
Jun 20, 2025
Merged

Update duration formatting to use Intl.DurationFormat#857
timja merged 6 commits intojenkinsci:mainfrom
lewisbirks:duration-format

Conversation

@lewisbirks
Copy link
Contributor

@lewisbirks lewisbirks commented Jun 19, 2025

Closes #840

Migrate from custom duration formatting messages to those provided by Intl.DurationFormat.

I have tried to keep the consistency in number of digits displayed the same as it was before but if we want this can be altered further.

By using this formatter, it does make the durations generated in the frontend inconsistent with those generated in the backend, see the run detail cards.

I've updated us to node 24 as part of this as the functionality was only introduced in node 23. I have added a polyfill for users that are not on the latest version of their browsers as I expect that it will error out if it runs into that scenario (this shouldn't impact most users, maybe just firefox).

I've had to disable TS checking on the formatter construction as TS does not yet support it.

Testing done

Manual testing with Bulgarian

image

image

English for comparison

image

image

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
@lewisbirks lewisbirks marked this pull request as ready for review June 20, 2025 10:01
@lewisbirks lewisbirks requested a review from a team as a code owner June 20, 2025 10:01
@timja timja added the enhancement New feature or request label Jun 20, 2025
@timja timja merged commit 8f4746b into jenkinsci:main Jun 20, 2025
17 checks passed
@lewisbirks lewisbirks deleted the duration-format branch June 23, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I suggest abbreviating all time units like ‘’4min 25 seg to ‘’4m25s’’ so it looks more friendly.

2 participants