Skip to content

Conversation

@chenjiahan
Copy link
Member

Summary

Updates the prettyTime function to improve how time is formatted for better readability and accuracy.

  • before: 20.57 m
  • after: 20 m 34 s

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings July 7, 2025 05:35
@netlify
Copy link

netlify bot commented Jul 7, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit a1c9e08
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/686b5c9b14c49a00084060e4
😎 Deploy Preview https://deploy-preview-5555--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 71 (🔴 down 7 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Updates the prettyTime helper to display minutes and seconds instead of decimal minutes, and adjusts tests to match the new output format.

  • Changed formatting logic to split minutes and remaining seconds
  • Updated tests to verify minute-only and minute-second cases

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/core/src/helpers/index.ts Refactored prettyTime to use Math.floor for minutes and show leftover seconds
packages/core/tests/helpers.test.ts Adjusted test expectations for new minute/second format
Comments suppressed due to low confidence (2)

packages/core/tests/helpers.test.ts:94

  • Consider adding a test for exactly 60 seconds (e.g., expect(prettyTime(60)).toEqual('1 m');) to cover the boundary where remainingSeconds === 0.
  expect(prettyTime(120)).toEqual('2 m');

packages/core/src/helpers/index.ts:349

  • [nitpick] Using strict equality against 0 on floating-point values can be brittle; consider using Number.isInteger(remainingSeconds) to guard against precision errors.
  if (remainingSeconds === 0) {

@chenjiahan chenjiahan requested a review from 9aoy July 7, 2025 05:36
@chenjiahan chenjiahan changed the title fix: improve build time minute formats fix: improve formatting of minutes in build time Jul 7, 2025
@chenjiahan chenjiahan merged commit 6ed6603 into main Jul 7, 2025
14 checks passed
@chenjiahan chenjiahan deleted the build_time_0707 branch July 7, 2025 05:50
@chenjiahan chenjiahan mentioned this pull request Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants