Skip to content

Timestamps from the API seem to get deserialized wrongly #29

@Stummi

Description

@Stummi

I will just lead with some example code (it's kotlin, hope its okay, but the gist should be clear)

fun main() {
  val client = StreamSDKClient()
  val updateUsersRequest = UpdateUsersRequest().apply {
    users = mapOf("test" to UserRequest().apply {
      id = "tester"
      name = "Tester"
    })
  }
  client.updateUsers(
    updateUsersRequest
  ).execute().data.users.forEach {
    println(it)
  }
}

The output looks like this:

tester=FullUserResponse(banned=false, createdAt=Thu May 22 23:25:49 CEST 55808194, id=tester, invisible=false, language=, online=false, role=user, shadowBanned=false, totalUnreadCount=0, unreadChannels=0, unreadCount=0, unreadThreads=0, updatedAt=Thu May 22 23:25:49 CEST 55808194, blockedUserIds=[], channelMutes=[], devices=[], mutes=[], teams=[], custom={}, avgResponseTime=null, banExpires=null, deactivatedAt=null, deletedAt=null, image=null, lastActive=null, name=Tester, revokeTokensIssuedBefore=null, latestHiddenChannels=null, privacySettings=null, teamsRole=null)

As you see, the date is completely off: createdAt=Thu May 22 23:25:49 CEST 55808194 which is (roughly, maybe due to precission issues) the value if you multiply the current timestamp with 1e6.

The reasons seems to be that the V2 api responds with timestamps in microseconds resulution (e.g. 1761074344387549000), but the objectMapper the SDK is using to deserialize the response is not configured to understand these timestamps.

It's not a grave issue for us since we are not using this timestamp. I just noticed and thought I should share.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions