thêm chức năng Sos và thêm glustack-ui

This commit is contained in:
Tran Anh Tuan
2025-11-04 16:24:54 +07:00
parent e535aaa1e8
commit 2137925ba9
33 changed files with 5533 additions and 171 deletions

View File

@@ -86,3 +86,25 @@ export const getBanzoneNameByType = (type: number) => {
return "Chưa có";
}
};
export const convertToDMS = (value: number, isLat: boolean): string => {
const deg = Math.floor(Math.abs(value));
const minFloat = (Math.abs(value) - deg) * 60;
const min = Math.floor(minFloat);
const sec = (minFloat - min) * 60;
const direction = value >= 0 ? (isLat ? "N" : "E") : isLat ? "S" : "W";
return `${deg}°${min}'${sec.toFixed(2)}"${direction}`;
};
/**
* Chuyển đổi tốc độ từ km/h sang knot (hải lý/giờ)
* @param kmh - tốc độ tính bằng km/h
* @returns tốc độ tính bằng knot
*/
export function kmhToKnot(kmh: number): number {
const KNOT_PER_KMH = 1 / 1.852; // 1 knot = 1.852 km/h
return parseFloat((kmh * KNOT_PER_KMH).toFixed(2)); // làm tròn 2 chữ số thập phân
}