From 14c1c31ce47560bad7509fe68afee5467112be30 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 4 Aug 2018 13:17:12 +0200 Subject: Use first day of week from locale --- views/calendar/qml/WeekView.qml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/views/calendar/qml/WeekView.qml b/views/calendar/qml/WeekView.qml index ba9b24d2..f78a4a8d 100644 --- a/views/calendar/qml/WeekView.qml +++ b/views/calendar/qml/WeekView.qml @@ -30,14 +30,15 @@ FocusScope { property var hourHeight: Kube.Units.gridUnit * 2 property date currentDate - function getMonday(date) { + function getFirstDayOfWeek(date) { + var firstDay = Qt.locale().firstDayOfWeek var year = date.getFullYear() var month = date.getMonth() //Jup, getDate returns the day of the month var day = date.getDate() while (true) { - if (date.getDay() === Locale.Monday) { + if (date.getDay() === firstDay) { return date } day = day - 1 @@ -46,7 +47,7 @@ FocusScope { return date } - property date startDate: getMonday(currentDate) + property date startDate: getFirstDayOfWeek(currentDate) Item { anchors { -- cgit v1.2.3