mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
fix(mobile): send a full datetime from the android memories widget (#29689)
This commit is contained in:
parent
20e123c839
commit
9c8d718ddc
1 changed files with 3 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ import java.net.HttpURLConnection
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
|
import java.time.ZoneOffset
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
class ImmichAPI(cfg: ServerConfig) {
|
class ImmichAPI(cfg: ServerConfig) {
|
||||||
|
|
@ -88,7 +89,8 @@ class ImmichAPI(cfg: ServerConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun fetchMemory(date: LocalDate): List<MemoryResult> = withContext(Dispatchers.IO) {
|
suspend fun fetchMemory(date: LocalDate): List<MemoryResult> = withContext(Dispatchers.IO) {
|
||||||
val iso8601 = date.format(DateTimeFormatter.ISO_LOCAL_DATE)
|
// server matches memories by the UTC day, so send noon UTC of the local day to land on the right day in every timezone
|
||||||
|
val iso8601 = date.atTime(12, 0).atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
|
||||||
val url = buildRequestURL("/memories", listOf("for" to iso8601))
|
val url = buildRequestURL("/memories", listOf("for" to iso8601))
|
||||||
val connection = (url.openConnection() as HttpURLConnection).apply {
|
val connection = (url.openConnection() as HttpURLConnection).apply {
|
||||||
requestMethod = "GET"
|
requestMethod = "GET"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue