Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
miuss committed Dec 5, 2024
1 parent 40e9a5b commit dd4cb6d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ export const calculateRemainingDays = (expireTime) => {
}

export const formatBandwithBytes = (bytes) => {
bytes = bytes * 8;
const units = ['bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps', 'Zbps', 'Ybps'];
let i = 0;
while (bytes >= 1024 && i < units.length - 1) {
bytes /= 1024;
i++;
}
return (bytes*8).toFixed(2) + ' ' + units[i];
return (bytes).toFixed(2) + ' ' + units[i];
}

// 格式化系统时间为小时:分钟:秒
Expand Down

0 comments on commit dd4cb6d

Please sign in to comment.