After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772100 - Setting time may make the event date span backward
Setting time may make the event date span backward
Status: RESOLVED OBSOLETE
Product: gnome-calendar
Classification: Applications
Component: Edit dialog
3.21.x
Other Linux
: Normal normal
: 3.26
Assigned To: GNOME Calendar maintainers
GNOME Calendar maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-28 04:27 UTC by Mohammed Sadiq
Modified: 2017-11-24 21:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Calendar new event creation (video) (226.65 KB, video/webm)
2016-09-28 04:27 UTC, Mohammed Sadiq
  Details
Reproduced bug report, with further observations. (604.50 KB, video/webm)
2017-01-19 10:18 UTC, hbhyrava
  Details
edit-dialog: fix date span backward (2.53 KB, patch)
2017-02-20 12:26 UTC, Ceapa Andrei
committed Details | Review
Fix the date spanning backwards in the edit-dialog (1.08 KB, patch)
2017-03-11 01:50 UTC, Utkarsh Maheshwari
needs-work Details | Review
changed sync_datetimes function to fix the problem (617 bytes, patch)
2017-08-05 06:49 UTC, newtodisworld
none Details | Review
have made some changes to sync_datetimes function to fix the problem (1.59 KB, patch)
2017-08-06 06:53 UTC, newtodisworld
none Details | Review
Patch to fix the problem (1.99 KB, patch)
2017-08-19 07:00 UTC, newtodisworld
none Details | Review
Proposed patch taking into account all day events (2.55 KB, patch)
2017-08-21 05:09 UTC, newtodisworld
committed Details | Review
Fix for the timezone issue (1.57 KB, patch)
2017-09-22 06:59 UTC, newtodisworld
none Details | Review

Description Mohammed Sadiq 2016-09-28 04:27:28 UTC
Created attachment 336415 [details]
Calendar new event creation (video)

Setting a time for an 'All day' event may make the event dated backward. This seems to happen only for single day events.

See the attached screencast (The event is added on 29th Sept, when time is set, the end date sets to 28th)
Comment 1 hbhyrava 2017-01-19 10:18:52 UTC
Created attachment 343786 [details]
Reproduced bug report, with further observations.
Comment 2 Ceapa Andrei 2017-02-20 12:26:35 UTC
Created attachment 346258 [details] [review]
edit-dialog: fix date span backward

The problem is that the end date might change to one before the
start date when modifying the start time.

Treat some cases taking into consideration the start date and start
time related to the fact that an event is spanning all day or not.
Separate the handling of the start date and start time.
Comment 3 Georges Basile Stavracas Neto 2017-03-07 00:57:52 UTC
Thanks for the patch!

Attachment 346258 [details] pushed as 1228f05 - edit-dialog: fix date span backward
Comment 4 Georges Basile Stavracas Neto 2017-03-07 01:20:17 UTC
Sorry, this was a mistake. I reverted the patch, and will review it properly.
Comment 5 Ceapa Andrei 2017-03-07 19:39:38 UTC
(In reply to Georges Basile Stavracas Neto from comment #4)
> Sorry, this was a mistake. I reverted the patch, and will review it properly.

No problem. I'm waiting for the review.
Comment 6 Utkarsh Maheshwari 2017-03-11 01:50:57 UTC
Created attachment 347676 [details] [review]
Fix the date spanning backwards in the edit-dialog
Comment 7 Utkarsh Maheshwari 2017-03-11 01:53:40 UTC
(In reply to Utkarsh Maheshwari from comment #6)
> Created attachment 347676 [details] [review] [review]
> Fix the date spanning backwards in the edit-dialog

I think this might solve the problem. This is my first attempt for gnome-calendar. Waiting eagerly for review... :)
Comment 8 Georges Basile Stavracas Neto 2017-03-15 00:32:06 UTC
Review of attachment 347676 [details] [review]:

This is wrong. It leaks whatever GDateTime was set before, and doesn't solve the real cause of the problem. I suspect the real issue is at GcalDateChooser.
Comment 9 newtodisworld 2017-08-05 06:49:05 UTC
Created attachment 356992 [details] [review]
changed sync_datetimes function to fix the problem
Comment 10 newtodisworld 2017-08-06 06:53:40 UTC
Created attachment 357045 [details] [review]
have made some changes to sync_datetimes function to fix the problem

I would be happy if someone can apply the patch and see if it doesn't break anything.

I couldn't find any other place to make changes than sync_datetimes function. If it isn't the correct place, I am ready to dig further.
Comment 11 Georges Basile Stavracas Neto 2017-08-19 02:38:06 UTC
Review of attachment 357045 [details] [review]:

Your patch is missing a commit message, and thus cannot be applied. Other than that, and the comments below, it looks good!

What do you think about helping porting the time selector widgets to GtkEntry? :)

::: src/gcal-edit-dialog.c
@@ +391,3 @@
    */
+  start_local = g_date_time_to_local(start);
+  end_local = g_date_time_to_local(end);

Wrong style (needs space before parenthesis).

@@ +404,3 @@
   else
     {
+      new_date = g_date_time_add_hours (end_local, -(hour_to_add));

No need to wrap hour_to_add in parenthesis
Comment 12 newtodisworld 2017-08-19 07:00:24 UTC
Created attachment 357957 [details] [review]
Patch to fix the problem

thanks Georges, I have made the suggested changes and have written a commit message as well. I don't mind commit_message/code being edited before being committed.

And as I am pretty much new to GNOME, I am not sure how much of help I might be. But I am planning to stick around and contribute whatever I can.
Comment 13 newtodisworld 2017-08-19 11:15:40 UTC
Review of attachment 357957 [details] [review]:

there is a minor bug in the patch though. It shouldn't convert an all_day_event to local timezone.
Comment 14 Georges Basile Stavracas Neto 2017-08-19 13:28:32 UTC
(In reply to newtodisworld from comment #12)

> thanks Georges, I have made the suggested changes and have written a commit
> message as well. I don't mind commit_message/code being edited before being
> committed.

Cool.

> And as I am pretty much new to GNOME, I am not sure how much of help I might
> be. But I am planning to stick around and contribute whatever I can.

You're free to contribute as much as you want, wherever you want =)
Comment 15 newtodisworld 2017-08-21 05:09:09 UTC
Created attachment 358046 [details] [review]
Proposed patch taking into account all day events

I have taken into account all day events as well. Please review the patch.
Comment 16 Georges Basile Stavracas Neto 2017-08-23 21:56:07 UTC
I'll fix the remaining style issues with the patch, and push it. Thanks for the patch.
Comment 17 Georges Basile Stavracas Neto 2017-08-23 21:58:03 UTC
Thanks for the patch.
Comment 18 Mohammed Sadiq 2017-09-03 01:44:54 UTC
Reopening. This has been fixed only in the UI. The event saved is still off by Time zone.

This can be reproduced by creating the event in gnome-calendar and checking them in gnome-shell events list or evolution.
Comment 19 newtodisworld 2017-09-07 03:48:31 UTC
(In reply to Mohammed Sadiq from comment #18)
> Reopening. This has been fixed only in the UI. The event saved is still off
> by Time zone.
> 
> This can be reproduced by creating the event in gnome-calendar and checking
> them in gnome-shell events list or evolution.

Thanks Sadiq for the comment. I will look into it.
Comment 20 newtodisworld 2017-09-12 07:21:51 UTC
(In reply to Mohammed Sadiq from comment #18)
> Reopening. This has been fixed only in the UI. The event saved is still off
> by Time zone.
> 
> This can be reproduced by creating the event in gnome-calendar and checking
> them in gnome-shell events list or evolution.

Hi Sadiq,

Can you please confirm if the problem existed before the fix or got introduced by the fix?

Amandeep
Comment 21 Mohammed Sadiq 2017-09-12 08:06:17 UTC
(In reply to newtodisworld from comment #20)
> Hi Sadiq,
Hi

> Can you please confirm if the problem existed before the fix or got
> introduced by the fix?

It is present in 3.22.4. So I believe it existed long back.
Comment 22 newtodisworld 2017-09-21 08:50:03 UTC
(In reply to Mohammed Sadiq from comment #21)
> (In reply to newtodisworld from comment #20)
> > Hi Sadiq,
> Hi
> 
> > Can you please confirm if the problem existed before the fix or got
> > introduced by the fix?
> 
> It is present in 3.22.4. So I believe it existed long back.

Hi Sadiq,

The issue of event being saved off by Timezone is a different issue than event day spanning backwards. So, in my opinion a new bug should be opened to track this issue and this one should be closed.
Comment 23 newtodisworld 2017-09-22 06:59:09 UTC
Created attachment 360241 [details] [review]
Fix for the timezone issue

Whenever user toggles All Day Check Box, the timezone of the event should be changed to UTC or LMT as the case may be. I am not sure though, if we need to consider any other TimeZone.
Comment 24 Georges Basile Stavracas Neto 2017-11-24 21:58:10 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-calendar/issues/74.