mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 16:51:13 -05:00
feat: Add imperial unit support to ride form
This commit is contained in:
@@ -30,6 +30,28 @@ export function convertHeight(cm: number, system: MeasurementSystem): number {
|
||||
return Math.round(cm);
|
||||
}
|
||||
|
||||
// Reverse conversions (for form inputs - imperial to metric)
|
||||
export function convertSpeedToMetric(value: number, system: MeasurementSystem): number {
|
||||
if (system === 'imperial') {
|
||||
return Math.round(value / 0.621371);
|
||||
}
|
||||
return Math.round(value);
|
||||
}
|
||||
|
||||
export function convertDistanceToMetric(value: number, system: MeasurementSystem): number {
|
||||
if (system === 'imperial') {
|
||||
return Math.round(value / 3.28084);
|
||||
}
|
||||
return Math.round(value);
|
||||
}
|
||||
|
||||
export function convertHeightToMetric(value: number, system: MeasurementSystem): number {
|
||||
if (system === 'imperial') {
|
||||
return Math.round(value / 0.393701);
|
||||
}
|
||||
return Math.round(value);
|
||||
}
|
||||
|
||||
// Get unit labels
|
||||
export function getSpeedUnit(system: MeasurementSystem): string {
|
||||
return system === 'imperial' ? 'mph' : 'km/h';
|
||||
|
||||
Reference in New Issue
Block a user