mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
Update maximal date on every DateInput dropdown toggle
This commit is contained in:
@ -33,10 +33,11 @@ Rectangle {
|
|||||||
property var dropDownStyle : Style.dropDownLight
|
property var dropDownStyle : Style.dropDownLight
|
||||||
|
|
||||||
// dates
|
// dates
|
||||||
property date currentDate : new Date() // default now
|
property date currentDate : new Date() // default now
|
||||||
property date minDate : new Date(0) // default epoch start
|
property date minDate : new Date(0) // default epoch start
|
||||||
property date maxDate : new Date() // default now
|
property date maxDate : new Date() // default now
|
||||||
property int unix : Math.floor(currentDate.getTime()/1000)
|
property bool isMaxDateToday : false
|
||||||
|
property int unix : Math.floor(currentDate.getTime()/1000)
|
||||||
|
|
||||||
onMinDateChanged: {
|
onMinDateChanged: {
|
||||||
if (isNaN(minDate.getTime()) || minDate.getTime() > maxDate.getTime()) {
|
if (isNaN(minDate.getTime()) || minDate.getTime() > maxDate.getTime()) {
|
||||||
@ -103,6 +104,11 @@ Rectangle {
|
|||||||
onActivated: updateRange()
|
onActivated: updateRange()
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
dropDownStyle: root.dropDownStyle
|
dropDownStyle: root.dropDownStyle
|
||||||
|
onDownChanged: {
|
||||||
|
if (root.isMaxDateToday){
|
||||||
|
root.maxDate = new Date()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@ -120,6 +126,11 @@ Rectangle {
|
|||||||
onActivated: updateRange()
|
onActivated: updateRange()
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
dropDownStyle: root.dropDownStyle
|
dropDownStyle: root.dropDownStyle
|
||||||
|
onDownChanged: {
|
||||||
|
if (root.isMaxDateToday){
|
||||||
|
root.maxDate = new Date()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@ -136,6 +147,11 @@ Rectangle {
|
|||||||
onActivated: updateRange()
|
onActivated: updateRange()
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
dropDownStyle: root.dropDownStyle
|
dropDownStyle: root.dropDownStyle
|
||||||
|
onDownChanged: {
|
||||||
|
if (root.isMaxDateToday){
|
||||||
|
root.maxDate = new Date()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,4 +256,3 @@ Rectangle {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,6 +63,7 @@ Column {
|
|||||||
metricsLabel: inputDateFrom.label
|
metricsLabel: inputDateFrom.label
|
||||||
currentDate: new Date() // now
|
currentDate: new Date() // now
|
||||||
minDate: inputDateFrom.currentDate
|
minDate: inputDateFrom.currentDate
|
||||||
|
isMaxDateToday: true
|
||||||
dropDownStyle: dateRange.dropDownStyle
|
dropDownStyle: dateRange.dropDownStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,7 @@ Row {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
currentDate: new Date() // default now
|
currentDate: new Date() // default now
|
||||||
minDate: inputDateFrom.currentDate
|
minDate: inputDateFrom.currentDate
|
||||||
|
isMaxDateToday: true
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBoxLabel {
|
CheckBoxLabel {
|
||||||
|
|||||||
Reference in New Issue
Block a user