Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong timezone information in schedule.xml export #1188

Closed
a-tze opened this issue Sep 10, 2016 · 19 comments · Fixed by #2512
Closed

Wrong timezone information in schedule.xml export #1188

a-tze opened this issue Sep 10, 2016 · 19 comments · Fixed by #2512

Comments

@a-tze
Copy link

a-tze commented Sep 10, 2016

The element of the elements in the export have an trailing Z indicating UTC while the datetime itself seems to be a local time.

@differentreality
Copy link
Contributor

I think that's happening because the time during scheduling is saved in UTC instead of conference timezone, and that's what we should really address.

@sharawatankit
Copy link

sharawatankit commented Mar 4, 2017

@differentreality
hi, I am beginner want to work on this, can I? if yes then please direct me from where to start.

@Ana06
Copy link
Member

Ana06 commented Mar 7, 2017

@differentreality

I think that's happening because the time during scheduling is saved in UTC instead of conference timezone, and that's what we should really address.

Not really, it is not needed to save the schedules in the conference timezone. If we do so we have to deal with that in all the schedule and that's a lot of changes and we will also complicate the code. I think it is enough to take this into account when exporting schedule.xml

@Ana06
Copy link
Member

Ana06 commented Mar 7, 2017

@nikhilgupta1211
Copy link
Contributor

@Ana06 can i work on this ?

@differentreality
Copy link
Contributor

@nikhilgupta1211 what exactly are you going to work on - what are you going to implement in order to solve this?

@nikhilgupta1211
Copy link
Contributor

@differentreality i think as @Ana06 said it is not needed to save the schedules in the conference timezone so for this issue we just have to convert the time zone in show.xml.haml to conference time zone which we can do with the help of in_time_zone

@differentreality
Copy link
Contributor

This is a delicate point, what we save in the DB is indeed UTC, but when we schedule something at 9am, this is supposed to be 9am of the conference time.

@a-tze
Copy link
Author

a-tze commented Mar 20, 2017

If I might comment here... I have no idea how your records are stored in database, but seeing you talk about "conversion" of time gives me the feeling that you're doing it wrong. Please, do not convert datetimes. The database does that for you. If it doesn't, you're doing it wrong.
The timezone that ends up in the XML actually doesn't matter. It just has to be correct, which is the actual issue here (trailing Z but not UTC). So if you have UTC in your database (and know for sure that it is UTC) then please export just that with the trailing Z and everything is fine regarding the schedule export.

@Ana06
Copy link
Member

Ana06 commented Mar 20, 2017

@differentreality it is much easier to work on UTC for the schedule, we just have to take care of rendering it properly in the places where we want to include the timezone.

@differentreality
Copy link
Contributor

@Ana06 I did not say otherwise. I am just saying that if the event is scheduled at 9am, the DB records 9am UTC, but what the organizer really means when the event was dropped in the schedule is 9am of local time of wherever the conference is happening, hence when we display the time in schedule.xml we should not convert that time, just not present as UTC.

@Ana06
Copy link
Member

Ana06 commented Mar 20, 2017

@differentreality ok 👍 I understood you wrong 😉

@nikhilgupta1211
Copy link
Contributor

nikhilgupta1211 commented Mar 20, 2017

@differentreality so a simple fix would be to remove the trailing Z in the xml .

@differentreality
Copy link
Contributor

And how will we know in which timezone those times in the xml are?

@nikhilgupta1211
Copy link
Contributor

@differentreality We can add a timezone tag in xml to show the conference timezone or we can do

tm = event.time
offset = tm.in_time_zone(@conference_time).utc_offset()
tm = tm.in_time_zone(@conference.timezone)
tm += -offset

This will convert the timezone to conference timezone without changing the time.
for Eg : Sun, 05 Mar 2017 11:00:00 UTC +00:00 to Sun, 05 Mar 2017 11:00:00 IST +05:30

@Ana06
Copy link
Member

Ana06 commented Mar 20, 2017

@nikhilgupta1211

This will convert the timezone to conference timezone without changing the time.

then just render the timezone of the conference withouf dealing with time changes and offsets. 😉

nikhilgupta1211 added a commit to nikhilgupta1211/osem that referenced this issue Mar 20, 2017
Removed the trailing Z from event.time and added a timezone tag in the xml file
@a-tze
Copy link
Author

a-tze commented Mar 25, 2017

Ok then. And what happens if your conference is today and tomorrow and takes place in Europe?

nikhilgupta1211 added a commit to nikhilgupta1211/osem that referenced this issue Mar 26, 2017
Removed the trailing Z from event.time and added a timezone tag in the xml file
@Ana06
Copy link
Member

Ana06 commented Mar 27, 2017

@a-tze

Ok then. And what happens if your conference is today and tomorrow and takes place in Europe?

What do you exactly mean?

@a-tze
Copy link
Author

a-tze commented Mar 27, 2017

I was referring to the this-year-magic-weekend with DST change. Is the conference timezone +0100 or +0200 then? Does it work if you plan the conference in February and schedule something for March 26th 10am, is it then magically 11am after DST change (it shouldn't be) and so on. In my experience you get around those problems only if you save every timestamp with timezone.
(And yes, we did already have a conference over DST change with frab and it did work surprisingly well ;) )

nikhilgupta1211 added a commit to nikhilgupta1211/osem that referenced this issue Mar 30, 2017
Removed the trailing Z from event.time and added a timezone tag in the xml file
nikhilgupta1211 added a commit to nikhilgupta1211/osem that referenced this issue Mar 30, 2017
Added an application helper method time_with_timezone to return time with the conference timezone
nikhilgupta1211 added a commit to nikhilgupta1211/osem that referenced this issue Mar 31, 2017
Added an application helper method time_with_timezone to return time with the conference timezone which solves the issue of wrong timezone in scheule.xml
nikhilgupta1211 added a commit to nikhilgupta1211/osem that referenced this issue Mar 31, 2017
Added an application helper method time_with_timezone to return time with the conference timezone Fixes openSUSE#1188
@Ana06 Ana06 closed this as completed in 73a6e06 Mar 31, 2017
Ana06 added a commit that referenced this issue Mar 31, 2017
Fixes #1188 show the conference timezone in show.xml.haml
eug3nix pushed a commit to commandprompt/osem-pg that referenced this issue May 8, 2017
Added an application helper method `time_with_timezone` to return time with the conference timezone which solves the issue of wrong timezone in `scheule.xml` and `admin/events#show`.

Fixes openSUSE#1188
Ana06 added a commit to Ana06/osem that referenced this issue May 2, 2019
Dates where using (some years ago) iso8601 without taking the timezone
into account, as reported in:

openSUSE#1188

When trying to fix the issue, the date was converted to an incorrect
format which took timezone into account in:

openSUSE@73a6e06

Come back to use iso8601 but taking the timezone into account.

Really fixes openSUSE#1188
Fixes openSUSE#2510
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants