finishes profile page

This commit is contained in:
Christian Beutel
2024-11-05 00:47:47 +01:00
parent bab22301af
commit 87eb879c7f
20 changed files with 541 additions and 187 deletions

View File

@@ -13,7 +13,7 @@ export function formatTimeHHMM(minutes?: number) {
return (h < 10 ? "0" : "") + h.toString() + "h " + (Math.round(m) < 10 ? "0" : "") + Math.round(m).toString() + "m";
}
export function formatDistance(meters?: number) {
export function formatDistance(meters?: number) {
if (meters === undefined) {
return "-";
}
@@ -50,6 +50,22 @@ export function formatElevation(meters?: number) {
}
}
export function formatSpeed(speed?: number) {
if (speed === undefined) {
return "-";
}
const unit = get(page).data.settings?.unit ?? "metric";
if (unit == "metric") {
return `${Math.round(speed)} km/h`
} else {
const mph = speed * 0.621371;
return `${Math.round(mph)} mp/h`;
}
}
export function formatTimeSince(date: Date) {
var seconds = Math.floor((new Date().getTime() - date.getTime()) / 1000);