aboutsummaryrefslogtreecommitdiffstats
path: root/cgeo-calendar
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2014-01-26 10:19:05 +0100
committerSamuel Tardieu <sam@rfc1149.net>2014-01-26 10:20:16 +0100
commit2a7f37dee8b9b1a8c600fc54c57a343a33c37d81 (patch)
tree5b9c064aa52f92e65f7b77e0ffd814c05be8e8d4 /cgeo-calendar
parent8aea00226b6dbc01eda53fd3009690047d6ce202 (diff)
downloadcgeo-2a7f37dee8b9b1a8c600fc54c57a343a33c37d81.zip
cgeo-2a7f37dee8b9b1a8c600fc54c57a343a33c37d81.tar.gz
cgeo-2a7f37dee8b9b1a8c600fc54c57a343a33c37d81.tar.bz2
fix #3553: all day events must have 00:00:00 UTC time boundaries
Diffstat (limited to 'cgeo-calendar')
-rw-r--r--cgeo-calendar/src/cgeo/calendar/AddEntry.java13
-rw-r--r--cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java11
2 files changed, 13 insertions, 11 deletions
diff --git a/cgeo-calendar/src/cgeo/calendar/AddEntry.java b/cgeo-calendar/src/cgeo/calendar/AddEntry.java
index ce8658d..cdb59d9 100644
--- a/cgeo-calendar/src/cgeo/calendar/AddEntry.java
+++ b/cgeo-calendar/src/cgeo/calendar/AddEntry.java
@@ -30,12 +30,13 @@ class AddEntry extends AbstractAddEntry {
// values
final ContentValues event = new ContentValues();
event.put("calendar_id", calendarId);
- if (entry.getStartTimeMinutes() >= 0) {
- event.put("dtstart", eventDate.getTime() + entry.getStartTimeMinutes() * 60000L);
- }
- else {
- event.put("dtstart", eventDate.getTime() + 43200000); // noon
- event.put("dtend", eventDate.getTime() + 43200000 + 3600000); // + one hour
+ final long eventTime = eventDate.getTime();
+ final int entryStartTimeMinutes = entry.getStartTimeMinutes();
+ if (entryStartTimeMinutes >= 0) {
+ event.put("dtstart", eventTime + entryStartTimeMinutes * 60000L);
+ } else {
+ event.put("dtstart", eventTime); // midnight
+ event.put("dtend", eventTime + 86400000); // + one day
event.put("allDay", 1);
}
event.put("eventTimezone", "UTC");
diff --git a/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java b/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java
index b6a451e..0ceed67 100644
--- a/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java
+++ b/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java
@@ -32,11 +32,12 @@ class AddEntryLevel14 extends AbstractAddEntry {
.putExtra("description", description)
.putExtra("hasAlarm", false)
.putExtra("eventTimezone", "UTC");
- if (entry.getStartTimeMinutes() >= 0) {
- intent.putExtra("beginTime", eventDate.getTime() + entry.getStartTimeMinutes() * 60000L);
- }
- else {
- intent.putExtra("beginTime", eventDate.getTime() + 43200000);
+ final long eventTime = eventDate.getTime();
+ final int entryStartTimeMinutes = entry.getStartTimeMinutes();
+ if (entryStartTimeMinutes >= 0) {
+ intent.putExtra("beginTime", eventTime + entryStartTimeMinutes * 60000L);
+ } else {
+ intent.putExtra("beginTime", eventTime);
intent.putExtra("allDay", true);
}
if (entry.getCoords().length() > 0) {