This commit is contained in:
Stefano Moretti
2023-06-29 13:52:51 +02:00
parent 768bb75de4
commit 51e8aad0d9
4 changed files with 15 additions and 31 deletions

View File

@ -9,6 +9,7 @@ Item {
id: root
property string locale: "en_US"
property bool selected: false
property date selectedDate: new Date()
readonly property int day: selectedDate.getDate()
@ -16,6 +17,8 @@ Item {
readonly property int year: selectedDate.getFullYear()
readonly property string dateString: year + "-" + _zeroPad(month + 1) + "-" + _zeroPad(day)
signal tappedOnADate()
function _zeroPad(n) { return n > 9 ? n : '0' + n }
implicitHeight: column.implicitHeight
@ -113,7 +116,7 @@ Item {
// Important: check the month to avoid clicking on days outside where opacity 0
if (d.getMonth() === monthGrid.month) {
root.selectedDate = d
console.log("tapped on a date ")
root.tappedOnADate()
} else {
console.log("outside valid month " + d.getMonth())
}
@ -123,7 +126,8 @@ Item {
id: dayLabel
readonly property bool selected:
model.day === root.day
root.selected
&& model.day === root.day
&& model.month === root.month
&& model.year === root.year