diff --git a/applets/digital-clock/package/contents/ui/Tooltip.qml b/applets/digital-clock/package/contents/ui/Tooltip.qml --- a/applets/digital-clock/package/contents/ui/Tooltip.qml +++ b/applets/digital-clock/package/contents/ui/Tooltip.qml @@ -36,17 +36,22 @@ LayoutMirroring.childrenInherit: true function timeForZone(zone) { + var compactRepresentationItem = plasmoid.compactRepresentationItem; + if (!compactRepresentationItem) { + return ""; + } + // get the time for the given timezone from the dataengine var now = dataSource.data[zone]["DateTime"]; // get current UTC time var msUTC = now.getTime() + (now.getTimezoneOffset() * 60000); // add the dataengine TZ offset to it var dateTime = new Date(msUTC + (dataSource.data[zone]["Offset"] * 1000)); - var formattedTime = Qt.formatTime(dateTime, plasmoid.compactRepresentationItem.timeFormat); + var formattedTime = Qt.formatTime(dateTime, compactRepresentationItem.timeFormat); if (dateTime.getDay() != dataSource.data["Local"]["DateTime"].getDay()) { - formattedTime += " (" + Qt.formatDate(dateTime, plasmoid.compactRepresentationItem.dateFormat) + ")"; + formattedTime += " (" + Qt.formatDate(dateTime, compactRepresentationItem.dateFormat) + ")"; } return formattedTime;