package mx.trackermap.TrackerMap.utils import kotlinx.datetime.* import kotlin.math.round class Formatter { companion object { fun formatDate(date: String): String { return date.substring(0 until date.indexOf('+')) .toLocalDateTime().toString().replace('T', ' ') } fun formatSpeed(speed: Double, unit: SpeedUnit): String { return when (unit) { SpeedUnit.KMH -> { "${(speed * 1.852).toInt()} km/h" } SpeedUnit.MPH -> { "${(speed * 1.15078).toInt()} mph" } SpeedUnit.KN -> { "${speed.toInt()} kn" } } } } }