raniejade
12/20/2016, 8:43 AMthomasnield
12/20/2016, 5:30 PMthomasnield
12/20/2016, 9:39 PMthomasnield
12/20/2016, 9:40 PMron
12/21/2016, 12:42 PMron
12/21/2016, 12:43 PMedvin
12/21/2016, 2:53 PMedvin
12/21/2016, 2:56 PMitemProperty.onChange
for this, since it's not practical to create a binding towards item.times.creationTime
. After thinking about it, I think it's better to create a binding for dataCreated directly, since it would be updated whenever the item changes anyways 🙂edvin
12/21/2016, 2:56 PMedvin
12/21/2016, 2:58 PMval dateCreated = bind { SimpleObjectProperty(LocalDateTime.ofInstant(item?.times?.creationTime?.toInstant() ?: someDefaultValue, ZoneId.systemDefault())) }
edvin
12/21/2016, 2:58 PMron
12/21/2016, 2:59 PMedvin
12/21/2016, 2:59 PMtimes.creationTime
to LocalDateTime
though. What data type is it?ron
12/21/2016, 2:59 PMron
12/21/2016, 3:00 PMedvin
12/21/2016, 3:00 PMclass ObservableEntry(entry: Entry)
. And just to the nastyness in the constructor. Then the model would be clean, and all ui interaction with the object would be clean.edvin
12/21/2016, 3:00 PMtimes.creationTime
?ron
12/21/2016, 3:01 PMedvin
12/21/2016, 3:01 PMedvin
12/21/2016, 3:02 PMLocalDateTime
. That would clean up this whole mess, and make sure you only write that once.ron
12/21/2016, 3:02 PMron
12/21/2016, 3:03 PMedvin
12/21/2016, 3:03 PMfun Calendar.toLocalDateTime() = LocalDateTime.ofInstant(toInstant(), ZoneId.systemDefault())
edvin
12/21/2016, 3:05 PMval dateCreated = bind { SimpleObjectProperty(item?.times?.creationTime?.toLocalDate() ?: someDefaultValue) }
edvin
12/21/2016, 3:05 PMron
12/21/2016, 3:06 PMron
12/21/2016, 3:06 PM