Dont use kotlinx datetime
This commit is contained in:
@@ -12,7 +12,6 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation(libs.kotlinx.coroutines)
|
||||
implementation(libs.kotlinx.datetime)
|
||||
implementation(libs.ktor.serialization.json)
|
||||
implementation(libs.ktor.server.data.conversion)
|
||||
implementation(libs.mongodb.bson)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package ai.neuon.utility.json
|
||||
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlinx.serialization.json.*
|
||||
import kotlin.time.ExperimentalTime
|
||||
import kotlin.time.Instant
|
||||
|
||||
|
||||
/**
|
||||
@@ -113,6 +114,7 @@ fun JsonElement.asBooleanOrNull(): Boolean? {
|
||||
/**
|
||||
* @throws IllegalArgumentException if the current element is not a valid ISO 8601 [String]
|
||||
*/
|
||||
@OptIn(ExperimentalTime::class)
|
||||
fun JsonElement.asInstant(): Instant {
|
||||
val value = try {
|
||||
asString()
|
||||
@@ -125,6 +127,7 @@ fun JsonElement.asInstant(): Instant {
|
||||
/**
|
||||
* @return null if the current element is not a valid ISO 8601 [String]
|
||||
*/
|
||||
@OptIn(ExperimentalTime::class)
|
||||
fun JsonElement.asInstantOrNull(): Instant? {
|
||||
return try {
|
||||
asInstant()
|
||||
|
||||
Reference in New Issue
Block a user