Skip to content

Date not uploading correctly for different timezones #102

@vdkdamian

Description

@vdkdamian

When I update a custom date value to Parse, it does something wrong with the timezone. If I look in the database, it clearly shows that it added +1 hour. But when I read it in the app with ParseSwift, it shows it correctly.

I think there is something wrong with the conversion of Dates when uploading and reading from Parse.

We also have a website, and with the Parse API for PHP it does upload the correct date. So if we look in the database, the timeStamp is the same as updatedAt. But when reading that same timeStamp value in ParseSwift, it makes the date -1 hour. This is causing some issues for us.

I have this code:

let query = AppFiles.query("score" == score)
query.first(callbackQueue: .main) { results in
    switch results {
    case .success(var userFile):
        userFile.timeStamp = Date()
        
        userFile.save { result in
            switch result {
                case .success(_):
                    print("SUCCES")
                case .failure(let error):
                    print("FAIL")
                    print(error)
            }
        }
    case .failure(let error):
        print(error)
    }
}

This is a picture of what the dates look like when it is updated from the ParseSwift API:
Schermafbeelding 2021-03-27 om 16 37 10

So to wrap this issue up:

When updating the timeStamp from ParseSwift:

Dashboard shows this: 2021-03-27 16:31:40 +0000
Logging in swift shows this: 2021-03-27 15:31:40 +0000

When updating the timeStamp from Parse PHP:

Dashboard shows this: 2021-03-27 15:31:40 +0000
Logging in swift shows this: 2021-03-27 14:31:40 +0000

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions