1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-513 Sets | Fix | Date is displayed incorrectly in gallery view (#2657)

This commit is contained in:
Evgenii Kozlov 2022-10-13 22:26:40 +03:00 committed by GitHub
parent b9654f6f01
commit 3d4e49642c
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View file

@ -62,7 +62,7 @@ class ListViewItemRelationGroupWidget @JvmOverloads constructor(
}
is DefaultObjectRelationValueView.Date -> {
val value = relation.timeInMillis?.formatTimestamp(
isMillis = false,
isMillis = true,
format = relation.dateFormat
)
if (value != null) {

View file

@ -101,7 +101,7 @@ fun ObjectWrapper.Basic.values(
val value = DefaultObjectRelationValueView.Date(
objectId = id,
relationKey = relation.key,
timeInMillis = DateParser.parse(time),
timeInMillis = DateParser.parseInMillis(time),
dateFormat = format
)
values.add(value)

View file

@ -197,6 +197,19 @@ object DateParser {
}
return result
}
fun parseInMillis(value: Any?) : Long? {
val result: Long? = when (value) {
is String -> value.toLongOrNull()
is Double -> value.toLong()
is Long -> value
else -> null
}
return if (result!= null)
result * 1000
else
null
}
}
/**