Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(number-formatter): upgrade pretty-ms to 9.1.0 #30599

Merged
merged 3 commits into from
Oct 15, 2024

Conversation

villebro
Copy link
Member

@villebro villebro commented Oct 14, 2024

SUMMARY

Bump pretty-ms from 7.0.0 to 9.1.0, as this package hasn't been bumped in a long time. Notable changes:

  • 7.0.1: Fix to colonNotation for sub-second durations (the lock file was actually already pointing to 7.0.1)
  • 8.0.0: Drop support for CJS
  • 9.0.0 Support BigInt
  • 9.1.0 Support negative durations

Other changes:

  • Refactor tests from describe + it to test.
  • Add tests for negative durations, as those are now supported since 9.1.0. I recommend reviewing the diff with "Hide whitespace" to see the new tests.
  • Do a few minor tweaks to get jest working with the new version, as pretty-ms and parse-ms are now fully ESM.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

});
test('format milliseconds in human readable format with default options', () => {
const formatter = createDurationFormatter();
expect(formatter(-1000)).toBe('-1s');
Copy link
Member Author

@villebro villebro Oct 14, 2024

Choose a reason for hiding this comment

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

note the added negative duration tests that previously weren't supported.

@villebro villebro changed the title chore(number-formatter): upgrade pretty-ms to 9.1 chore(number-formatter): upgrade pretty-ms to 9.1.0 Oct 14, 2024
@@ -17,7 +17,7 @@
* under the License.
*/

import prettyMsFormatter from 'pretty-ms';
import prettyMilliseconds, { Options } from 'pretty-ms';
Copy link
Member Author

Choose a reason for hiding this comment

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

Renaming the default export to prettyMilliseconds, as that's what it's called in the source, and pull in Options via the newly exposed named export.

@villebro villebro merged commit 7132d5a into apache:master Oct 15, 2024
51 checks passed
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.

2 participants