Improvements on NIP-11
- Support for self, privacy_policy, terms_of_service, grasps - New UI for the Relay Information Screen - Improvements to the Debug Message - Compose-stable objects - Clickable elements for NIPs, external links, grasps, etc
This commit is contained in:
+45
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.commons.util
|
||||
|
||||
import com.sun.org.apache.xalan.internal.lib.ExsltDatetime.time
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
@@ -81,6 +82,50 @@ fun timeAgo(
|
||||
}
|
||||
}
|
||||
|
||||
fun timeDiffAgoLong(timeDifference: Int): String =
|
||||
when {
|
||||
timeDifference > TimeUtils.ONE_YEAR -> {
|
||||
(timeDifference / TimeUtils.ONE_YEAR).toString() + " years"
|
||||
}
|
||||
timeDifference > TimeUtils.ONE_MONTH -> {
|
||||
(timeDifference / TimeUtils.ONE_MONTH).toString() + " months"
|
||||
}
|
||||
timeDifference > TimeUtils.ONE_DAY -> {
|
||||
(timeDifference / TimeUtils.ONE_DAY).toString() + " days"
|
||||
}
|
||||
timeDifference > TimeUtils.ONE_HOUR -> {
|
||||
(timeDifference / TimeUtils.ONE_HOUR).toString() + " hours"
|
||||
}
|
||||
timeDifference > TimeUtils.ONE_MINUTE -> {
|
||||
(timeDifference / TimeUtils.ONE_MINUTE).toString() + " minutes"
|
||||
}
|
||||
else -> {
|
||||
"now"
|
||||
}
|
||||
}
|
||||
|
||||
fun timeDiffAgoShortish(timeDifference: Int): String =
|
||||
when {
|
||||
timeDifference > TimeUtils.ONE_YEAR -> {
|
||||
(timeDifference / TimeUtils.ONE_YEAR).toString() + " yrs"
|
||||
}
|
||||
timeDifference > TimeUtils.ONE_MONTH -> {
|
||||
(timeDifference / TimeUtils.ONE_MONTH).toString() + " mos"
|
||||
}
|
||||
timeDifference > TimeUtils.ONE_DAY -> {
|
||||
(timeDifference / TimeUtils.ONE_DAY).toString() + " days"
|
||||
}
|
||||
timeDifference > TimeUtils.ONE_HOUR -> {
|
||||
(timeDifference / TimeUtils.ONE_HOUR).toString() + " hrs"
|
||||
}
|
||||
timeDifference > TimeUtils.ONE_MINUTE -> {
|
||||
(timeDifference / TimeUtils.ONE_MINUTE).toString() + " mins"
|
||||
}
|
||||
else -> {
|
||||
"now"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a Unix timestamp as a date string.
|
||||
* For recent dates (< 1 day), returns the provided today string.
|
||||
|
||||
Reference in New Issue
Block a user