Commit 6b6c1018 authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Fixed JS date/time handling

parent 9be04fad
Pipeline #94888 canceled with stage
...@@ -436,7 +436,9 @@ QVariantMap IncidenceWrapper::recurrenceData() ...@@ -436,7 +436,9 @@ QVariantMap IncidenceWrapper::recurrenceData()
{QStringLiteral("duration"), m_incidence->recurrence()->duration()}, {QStringLiteral("duration"), m_incidence->recurrence()->duration()},
{QStringLiteral("frequency"), m_incidence->recurrence()->frequency()}, {QStringLiteral("frequency"), m_incidence->recurrence()->frequency()},
{QStringLiteral("startDateTime"), m_incidence->recurrence()->startDateTime()}, {QStringLiteral("startDateTime"), m_incidence->recurrence()->startDateTime()},
{QStringLiteral("startDateTimeDisplay"), QLocale::system().toString(m_incidence->recurrence()->startDateTime(), QLocale::NarrowFormat)},
{QStringLiteral("endDateTime"), m_incidence->recurrence()->endDateTime()}, {QStringLiteral("endDateTime"), m_incidence->recurrence()->endDateTime()},
{QStringLiteral("endDateTimeDisplay"), QLocale::system().toString(m_incidence->recurrence()->endDateTime(), QLocale::NarrowFormat)},
{QStringLiteral("allDay"), m_incidence->recurrence()->allDay()}, {QStringLiteral("allDay"), m_incidence->recurrence()->allDay()},
{QStringLiteral("type"), m_incidence->recurrence()->recurrenceType()}, {QStringLiteral("type"), m_incidence->recurrence()->recurrenceType()},
{QStringLiteral("monthDays"), QVariant::fromValue(m_incidence->recurrence()->monthDays())}, {QStringLiteral("monthDays"), QVariant::fromValue(m_incidence->recurrence()->monthDays())},
...@@ -484,11 +486,19 @@ void IncidenceWrapper::setRecurrenceDataItem(const QString &key, const QVariant ...@@ -484,11 +486,19 @@ void IncidenceWrapper::setRecurrenceDataItem(const QString &key, const QVariant
} else if (key == QStringLiteral("frequency")) { } else if (key == QStringLiteral("frequency")) {
m_incidence->recurrence()->setFrequency(value.toInt()); m_incidence->recurrence()->setFrequency(value.toInt());
} else if (key == QStringLiteral("startDateTime") && value.toDateTime().isValid()) { } else if ((key == QStringLiteral("startDateTime") || key == QStringLiteral("endDateTime")) && value.toDateTime().isValid()) {
m_incidence->recurrence()->setStartDateTime(value.toDateTime(), false); auto dt = value.toDateTime();
QDateTime adjustedDt;
adjustedDt.setTimeZone(incidenceEnd().timeZone());
adjustedDt.setDate(dt.date());
adjustedDt.setTime(dt.time());
} else if (key == QStringLiteral("endDateTime") && value.toDateTime().isValid()) { if (key == QStringLiteral("startDateTime")) {
m_incidence->recurrence()->setEndDateTime(value.toDateTime()); m_incidence->recurrence()->setStartDateTime(adjustedDt, false);
} else if (key == QStringLiteral("endDateTime")) {
m_incidence->recurrence()->setEndDateTime(adjustedDt);
}
} else if (key == QStringLiteral("allDay")) { } else if (key == QStringLiteral("allDay")) {
m_incidence->recurrence()->setAllDay(value.toBool()); m_incidence->recurrence()->setAllDay(value.toBool());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment