mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-04 23:59:29 +00:00
0.7.0 + migration back to klock
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package dev.inmo.micro_utils.ktor.server
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import dev.inmo.micro_utils.ktor.common.FromToDateTime
|
||||
import io.ktor.http.Parameters
|
||||
import kotlinx.datetime.Instant
|
||||
|
||||
val Parameters.extractFromToDateTime: FromToDateTime
|
||||
get() = FromToDateTime(
|
||||
get("from") ?.run { toLongOrNull() ?: (toDoubleOrNull() ?.toLong()) } ?.let { Instant.fromEpochMilliseconds(it) },
|
||||
get("to") ?.run { toLongOrNull() ?: (toDoubleOrNull() ?.toLong()) } ?.let { Instant.fromEpochMilliseconds(it) }
|
||||
get("from") ?.toDoubleOrNull() ?.let { DateTime(it) },
|
||||
get("to") ?.toDoubleOrNull() ?.let { DateTime(it) }
|
||||
)
|
||||
|
Reference in New Issue
Block a user