Skip to content

Commit

Permalink
Fix conversion of LocalDate to databse string (JetBrains#1411)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisheksingh0x558 authored Dec 25, 2021
1 parent 835c3b1 commit 5aab9ec
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class KotlinLocalDateColumnType : ColumnType(), IDateColumnType {
override fun nonNullValueToString(value: Any): String {
val instant = when (value) {
is String -> return value
is LocalDate -> Instant.fromEpochMilliseconds(value.atStartOfDayIn(DEFAULT_TIME_ZONE).epochSeconds)
is LocalDate -> Instant.fromEpochMilliseconds(value.atStartOfDayIn(DEFAULT_TIME_ZONE).toEpochMilliseconds())
is java.sql.Date -> Instant.fromEpochMilliseconds(value.time)
is java.sql.Timestamp -> Instant.fromEpochSeconds(value.time / MILLIS_IN_SECOND, value.nanos.toLong())
else -> error("Unexpected value: $value of ${value::class.qualifiedName}")
Expand Down

0 comments on commit 5aab9ec

Please sign in to comment.