summaryrefslogtreecommitdiffstats
path: root/views/calendar/qml/WeekView.qml
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-08-04 14:59:07 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-08-04 14:59:07 +0200
commitdd0e823ddd72dda8adb3da5adf896abaed4feffe (patch)
treea4610d4a9e9d2d6365a092fdfc4ddf1e87dfc3ca /views/calendar/qml/WeekView.qml
parent3cf284d8248efbb1556105b4be20a3b369923e4d (diff)
downloadkube-dd0e823ddd72dda8adb3da5adf896abaed4feffe.tar.gz
kube-dd0e823ddd72dda8adb3da5adf896abaed4feffe.zip
Always select first day of week initially
Diffstat (limited to 'views/calendar/qml/WeekView.qml')
-rw-r--r--views/calendar/qml/WeekView.qml20
1 files changed, 1 insertions, 19 deletions
diff --git a/views/calendar/qml/WeekView.qml b/views/calendar/qml/WeekView.qml
index 484a151f..c9717241 100644
--- a/views/calendar/qml/WeekView.qml
+++ b/views/calendar/qml/WeekView.qml
@@ -29,25 +29,7 @@ FocusScope {
29 property var dayWidth: (root.width - Kube.Units.gridUnit - Kube.Units.largeSpacing * 2) / root.daysToShow 29 property var dayWidth: (root.width - Kube.Units.gridUnit - Kube.Units.largeSpacing * 2) / root.daysToShow
30 property var hourHeight: Kube.Units.gridUnit * 2 30 property var hourHeight: Kube.Units.gridUnit * 2
31 property date currentDate 31 property date currentDate
32 32 property date startDate: currentDate
33 function getFirstDayOfWeek(date) {
34 var firstDay = Qt.locale().firstDayOfWeek
35 var year = date.getFullYear()
36 var month = date.getMonth()
37 //Jup, getDate returns the day of the month
38 var day = date.getDate()
39
40 while (true) {
41 if (date.getDay() === firstDay) {
42 return date
43 }
44 day = day - 1
45 date = new Date(year, month, day)
46 }
47 return date
48 }
49
50 property date startDate: getFirstDayOfWeek(currentDate)
51 33
52 Item { 34 Item {
53 anchors { 35 anchors {