attachment improvements

This commit is contained in:
zadam
2023-03-24 10:57:32 +01:00
parent fd8a2d4d92
commit 9be524ef89
8 changed files with 187 additions and 49 deletions

View File

@@ -114,6 +114,17 @@ function formatLabel(label) {
return str;
}
function formatSize(size) {
size = Math.max(Math.round(size / 1024), 1);
if (size < 1024) {
return `${size} KiB`;
}
else {
return `${Math.round(size / 102.4) / 10} MiB`;
}
}
function toObject(array, fn) {
const obj = {};
@@ -363,6 +374,7 @@ export default {
formatDate,
formatDateISO,
formatDateTime,
formatSize,
localNowDateTime,
now,
isElectron,