Skip to content

Comments

fix: fix kB/KiB confusion#1541

Open
wojtekmaj wants to merge 1 commit intonpmx-dev:mainfrom
wojtekmaj:kb-kib-confusion
Open

fix: fix kB/KiB confusion#1541
wojtekmaj wants to merge 1 commit intonpmx-dev:mainfrom
wojtekmaj:kb-kib-confusion

Conversation

@wojtekmaj
Copy link
Contributor

  • kB / MB means decimal units: 1000, 1,000,000.
  • KiB / MiB means binary units: 1024, 1,048,576.

We were calculating binary units while labeling them as decimal ones.

- kB / MB means decimal units: 1000, 1,000,000.
- KiB / MiB means binary units: 1024, 1,048,576.

We were calculating binary units while labeling them as decimal ones.
Copilot AI review requested due to automatic review settings February 18, 2026 11:30
@vercel
Copy link

vercel bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 18, 2026 11:32am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 18, 2026 11:32am
npmx-lunaria Ignored Ignored Feb 18, 2026 11:32am

Request Review

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

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

This pull request fixes a common kB/KiB unit confusion by changing the byte formatting from binary units (1024-based) to decimal units (1000-based) while maintaining the correct kB/MB labels. This aligns with international SI standards where kB means 1000 bytes and MB means 1,000,000 bytes, as opposed to binary units (KiB/MiB) which use powers of 1024.

Changes:

  • Updated useBytesFormatter to use decimal base (1000) instead of binary base (1024) for byte calculations
  • Added comprehensive unit tests to verify correct decimal-based formatting behavior

Reviewed changes

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

File Description
app/composables/useNumberFormatter.ts Changed byte formatting from binary (1024) to decimal (1000) base, introduced KB and MB constants
test/unit/app/composables/use-number-formatter.spec.ts Added new test suite covering byte, kB, and MB formatting with decimal base

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant