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:
parent
b9654f6f01
commit
3d4e49642c
3 changed files with 15 additions and 2 deletions
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue