You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
638 B
Kotlin
19 lines
638 B
Kotlin
package moe.odango.index.utils
|
|
|
|
import org.joda.time.DateTime
|
|
import org.joda.time.format.ISODateTimeFormat
|
|
|
|
class ISOTextConverter : io.requery.Converter<DateTime, String> {
|
|
override fun convertToMapped(type: Class<out DateTime>?, value: String?): DateTime? {
|
|
return DateTime.parse(value ?: return null)
|
|
}
|
|
|
|
override fun getPersistedType(): Class<String> = String::class.java
|
|
override fun getMappedType(): Class<DateTime> = DateTime::class.java
|
|
|
|
override fun convertToPersisted(value: DateTime): String =
|
|
value.toString(ISODateTimeFormat.dateTime())
|
|
|
|
override fun getPersistedSize(): Int? = null
|
|
}
|