All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.boot.support.LocalDateTimeConverter.kt Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.boot.support

import net.nemerosa.ontrack.common.Time.toLocalDateTime
import org.springframework.core.convert.converter.Converter
import org.springframework.stereotype.Component
import java.time.LocalDateTime
import java.time.ZonedDateTime

@Component
class LocalDateTimeConverter : Converter {

    override fun convert(source: String): LocalDateTime? {
        return if (source.isBlank()) {
            null
        } else {
            // Parses as a zoned date time
            val zonedDateTime = ZonedDateTime.parse(source)
            // Returns in local application time (UTC)
            toLocalDateTime(zonedDateTime)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy