Closed Loikas closed 4 months ago
I am not reproducing the issue on my end. Specifically from your screenshot it seems like and the description of your issue.
It seems the fix you are proposing is already implemented in the time utils, but rather being calculated on the backend, the offset is calculated on the frontend here.
export const nowUTC = (serverTime: number | undefined) => {
let now: Date;
if (serverTime === undefined) {
now = new Date();
} else {
now = new Date(serverTime);
}
return utcToZonedTime(Date.UTC(now.getUTCFullYear(),now.getUTCMonth(), now.getUTCDate(),
now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds()), "GMT");
}
However, based on the time shown anorther issue is indeed there, it looks like around midnight the trains have a day more than what is calculated on your end!
Due to timezone differences it is quite hard to reproduce, we have unit tests in place to find the specific error however it seems we are missing one edge case when the day switch.
Let me know if my assumptions looks wrong, and thanks for reporting the issue :)
Thanks for your response. I understand that it is difficult to reproduce and I didn't know about the backend solution. However even if it is a problem on my end, im not really sure how I should go about fixing it as im just loading the browser page without altering anything. It does seem to be fixed now. Which is weird, maybe it does indeed have to do with if it is almost the next day.
@Loikas I beleive because you will have this issue again around midnight, you indeed have a bug but a different one I suspect. Let me know if you stil have the problem when you play around at midnight. Thanks :)
I have the same issue here, happens all of the time. All train schedule times on the website are an hour behind.
Can confirm it happened for a friend on this link: https://edr.simrail.app/en2/station/GW However the time were correct on https://edr.simrail.app/en1/station/GW
He's in GMT+3 and it was around 23:00 irl for him. On the server (EN2) it was 08:00
Thanks everyone for your reports, I hope I finally fixed this in this commit. Will be included in the next patch.
See the image above, i am in a different when compared to the server, this is not an issue except i am currently in gmt + 1 which in turn also adds one hour to the scheduled arrival and departure times.
This should be easily fixable by changing the constructor in the station.ts file from new Date() to new Date(Date.UTC()) and then deducting the server timezone.
Hope this helps