Skip to content

Commit

Permalink
fix: change the chat to utc instead of local date, to match what come…
Browse files Browse the repository at this point in the history
…s from the database
  • Loading branch information
Veirt committed Dec 11, 2024
1 parent 26658d5 commit 15de26e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/src/main/java/com/tutortoise/tutortoise/data/model/Chat.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.tutortoise.tutortoise.data.model

import java.time.Instant
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter

data class ChatRoom(
val id: String,
val learnerId: String,
Expand Down Expand Up @@ -46,11 +50,9 @@ data class FirebaseMessage(
senderRole = senderRole,
content = content,
type = type,
sentAt = java.text.SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
java.util.Locale.getDefault()
)
.format(java.util.Date(sentAt)),
sentAt = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
.withZone(ZoneOffset.UTC)
.format(Instant.ofEpochMilli(sentAt)),
isRead = isRead
)
}
Expand Down

0 comments on commit 15de26e

Please sign in to comment.