Add time ago

This commit is contained in:
2020-08-21 20:59:49 +02:00
parent 2c967ebd8c
commit c367d5b613
4 changed files with 27 additions and 3 deletions
+10
View File
@@ -0,0 +1,10 @@
package be.simplenotes.app.utils
import org.ocpsoft.prettytime.PrettyTime
import java.time.LocalDateTime
import java.time.ZoneId
import java.util.*
private val prettyTime = PrettyTime()
fun LocalDateTime.toTimeAgo(): String = prettyTime.format(Date.from(atZone(ZoneId.systemDefault()).toInstant()))