-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cross-platform date and time handling
- Loading branch information
Showing
6 changed files
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
app/src/androidMain/kotlin/area/Area.kt → app/src/commonMain/kotlin/area/Area.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package area | ||
|
||
import java.time.ZonedDateTime | ||
import kotlinx.datetime.Instant | ||
|
||
data class Area( | ||
val id: Long, | ||
val tags: AreaTags, | ||
val updatedAt: ZonedDateTime, | ||
val updatedAt: Instant, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
package db | ||
|
||
import androidx.sqlite.SQLiteStatement | ||
import kotlinx.datetime.Instant | ||
import kotlinx.serialization.json.Json | ||
import kotlinx.serialization.json.JsonObject | ||
import kotlinx.serialization.json.jsonObject | ||
|
||
fun SQLiteStatement.getJsonObject(columnIndex: Int): JsonObject { | ||
return Json.parseToJsonElement(getText(columnIndex)).jsonObject | ||
} | ||
|
||
fun SQLiteStatement.getInstant(columnIndex: Int): Instant { | ||
return Instant.parse(getText(columnIndex)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters