Format time
This commit is contained in:
@@ -68,6 +68,9 @@ kotlin {
|
||||
|
||||
implementation("com.vitorpamplona.quartz:quartz:1.05.1")
|
||||
|
||||
|
||||
implementation(libs.kotlinx.datetime)
|
||||
|
||||
implementation(libs.ktor.client.core)
|
||||
implementation("io.ktor:ktor-client-websockets:3.4.1")
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json:3.4.1")
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package ac.aux.compose.extensions
|
||||
|
||||
import kotlinx.datetime.LocalDateTime
|
||||
import kotlinx.datetime.TimeZone
|
||||
import kotlinx.datetime.format
|
||||
import kotlinx.datetime.format.char
|
||||
import kotlinx.datetime.toLocalDateTime
|
||||
import kotlin.time.Instant
|
||||
|
||||
fun Instant.toFormattedTimeAndDateString(): String {
|
||||
return toLocalDateTime(TimeZone.currentSystemDefault()).format(
|
||||
LocalDateTime.Format {
|
||||
year()
|
||||
char('-')
|
||||
monthNumber()
|
||||
char('-')
|
||||
day()
|
||||
char(' ')
|
||||
hour()
|
||||
char(':')
|
||||
minute()
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package ac.aux.compose.ui.composable.widgets.feed
|
||||
|
||||
import ac.aux.compose.database.model.NostrEvent
|
||||
import ac.aux.compose.extensions.toFormattedTimeAndDateString
|
||||
import ac.aux.compose.ui.theme.AuxTheme
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
@@ -88,7 +89,7 @@ fun NostrEvent.ListView() {
|
||||
}
|
||||
|
||||
Text(
|
||||
text = createdAt.toString()
|
||||
text = createdAt.toFormattedTimeAndDateString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user