finishes profile page
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user