Skip to content

Commit

Permalink
[mkcal] Don't figure out all day status from zero time for events sto…
Browse files Browse the repository at this point in the history
…red with time zone.
  • Loading branch information
dcaliste committed Mar 26, 2020
1 parent ac24df7 commit 3ef4110
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/sqliteformat.cpp
Expand Up @@ -1160,11 +1160,23 @@ static KDateTime getDateTime(SqliteStorage *storage, sqlite3_stmt *stmt, int ind
date = sqlite3_column_int64(stmt, index + 1);
dateTime = storage->fromOriginTime(date);
dateTime.setTimeSpec(KDateTime::ClockTime);
if (isDate) {
// This is a workaround, for wrongly stored date
// as a date and time and not as a floating date.
QTime localTime(dateTime.time());
*isDate = dateTime.isValid() &&
localTime.hour() == 0 &&
localTime.minute() == 0 &&
localTime.second() == 0;
}
} else if (timezone == QStringLiteral(FLOATING_DATE)) {
date = sqlite3_column_int64(stmt, index + 1);
dateTime = storage->fromOriginTime(date);
dateTime.setTimeSpec(KDateTime::ClockTime);
dateTime.setDateOnly(true);
if (isDate) {
*isDate = dateTime.isValid();
}
} else {
date = sqlite3_column_int64(stmt, index);
dateTime = storage->fromOriginTime(date, timezone);
Expand All @@ -1174,13 +1186,9 @@ static KDateTime getDateTime(SqliteStorage *storage, sqlite3_stmt *stmt, int ind
date = sqlite3_column_int64(stmt, index + 1);
dateTime = storage->fromLocalOriginTime(date);
}
}
if (isDate) {
QTime localTime(dateTime.toLocalZone().time());
*isDate = dateTime.isValid() &&
localTime.hour() == 0 &&
localTime.minute() == 0 &&
localTime.second() == 0;
if (isDate) {
*isDate = false;
}
}
return dateTime;
}
Expand Down

0 comments on commit 3ef4110

Please sign in to comment.