[fix] metric parsing

This commit is contained in:
kwaroran
2023-12-06 06:17:50 +09:00
parent 148366c7eb
commit f717210832

View File

@@ -38,7 +38,7 @@ export function metricaPlugin(data:string, toSystem:'metrics'|'imperial'){
});
}
//convert height like 5' 11'' to 180 cm
const reg = /(\d+)'?\s*(\d+)"?/g;
const reg = /(\d+)'\s*(\d+)"/g;
data = data.replace(reg, (_, feet, inch) => {
const result = parseFloat(feet) * 30.48 + parseFloat(inch) * 2.54;
return `${result.toFixed(2)} cm`;