[API] Convert limsum to another unit


I am using the API to develop a Beeminder client that helps to manage timed goals, eg. ‘I will go to the gym 5 hours a week’.

So I’m displaying the Goal.limsum attribute, which returns a value like ‘+0.6 in 5 days’.
I would like to display the value (0.6) as a time, so it would show ‘36 min in 5 days’.
How could the API help me do that without parsing the limsum attribute?

Thanks for any help,

1 Like

For now here is what I did (Kotlin):

    val formattedLimsum: String?
        get() {
            val split = limsum.split(' ')
            return split.firstOrNull()?.let {
                val rest = split
                        .filterIndexed { index, s -> index > 0 }
                        .joinToString(" ")
                return "${formatHoursAsDuration(it.toFloat())} $rest"
1 Like

great question and thank you so much for the workaround in the meantime!