Skip to content

Remove offset from received timestamps when writing them to DB#1029

Closed
Toastbrot236 wants to merge 2 commits intoLittleBigRefresh:mainfrom
Toastbrot236:datetime-offset-fix
Closed

Remove offset from received timestamps when writing them to DB#1029
Toastbrot236 wants to merge 2 commits intoLittleBigRefresh:mainfrom
Toastbrot236:datetime-offset-fix

Conversation

@Toastbrot236
Copy link
Contributor

Closes #1028 by setting GameContest.StartDate, GameContest.EndDate and GameUser.BanExpiryDate to the UTC variant of the DateTimeOffsets received from API requests. Also includes tests for both cases.

@Toastbrot236
Copy link
Contributor Author

Closing, as this both avoids and even enhances the actual issue, which consists of Bunkum's JSON parser wrongfully parsing datetimes, which don't have a Z and also don't have an offset, into UTC and then appending its own environment's timezone offset. This means that the parsed timestamp will be different from what was received, which is unacceptable (would be better if the parser would either throw or just parse it as UTC without adding a bogus offset which wasn't there before).

For now, not accepting any datetimes with offsets means we will filter out such cases of badly parsed datetimes, at the cost of also rejecting datetimes which do have an offset set in the JSON.

Ideally, the parsing issue would somehow have to be fixed in Bunkum. We could also temporarily introduce a workaroud where we parse all JSON requests (or atleast just the datetimes) ourselves by using an EndpointService or something similar, but that might have its own disadvantages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove offsets from timestamps sent over APIv3 before saving them in DB

1 participant