Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit e0e3f552 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

date runner: match timezones by whether it's contained

Having to match Paris by "Europe/Par" is not intuitive.

BUG: 403271
parent 6fc98c8c
......@@ -83,13 +83,13 @@ QHash<QString, QDateTime> DateTimeRunner::datetime(const QStringRef& tz)
QTimeZone timeZone(zoneId);
const QString zoneName = QString::fromUtf8(zoneId);
if (zoneName.startsWith(tz, Qt::CaseInsensitive)) {
if (zoneName.contains(tz, Qt::CaseInsensitive)) {
ret[zoneName] = QDateTime::currentDateTimeUtc().toTimeZone(timeZone);
const QString country = QLocale::countryToString(;
if (country.startsWith(tz, Qt::CaseInsensitive)) {
if (country.contains(tz, Qt::CaseInsensitive)) {
ret[country] = QDateTime::currentDateTimeUtc().toTimeZone(timeZone);
......@@ -98,7 +98,7 @@ QHash<QString, QDateTime> DateTimeRunner::datetime(const QStringRef& tz)
// other possible names.
// Eg - depending on the current date, only CET or CEST will work
const QString abbr = timeZone.abbreviation(QDateTime::currentDateTime());
if (abbr.startsWith(tz, Qt::CaseInsensitive)) {
if (abbr.contains(tz, Qt::CaseInsensitive)) {
ret[abbr] = QDateTime::currentDateTimeUtc().toTimeZone(timeZone);
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