wip
This commit is contained in:
parent
fded02f5b2
commit
d711bc59e9
1 changed files with 60 additions and 17 deletions
|
@ -86,14 +86,37 @@ Column {
|
||||||
anchors.leftMargin: 12
|
anchors.leftMargin: 12
|
||||||
spacing: Appearance.spacing.normal
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
// Today's date
|
// Show dates in chronological order
|
||||||
|
Row {
|
||||||
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: Qt.formatDateTime(new Date(), "dd MMM yyyy")
|
text: {
|
||||||
|
if (!root.hasSelection) return Qt.formatDateTime(new Date(), "dd MMM yyyy")
|
||||||
|
|
||||||
|
const today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate())
|
||||||
|
const selected = new Date(root.selectedStartDate.getFullYear(), root.selectedStartDate.getMonth(), root.selectedStartDate.getDate())
|
||||||
|
const diffDays = Math.round((selected - today) / (1000 * 60 * 60 * 24))
|
||||||
|
|
||||||
|
// For past dates, show selected date first
|
||||||
|
if (diffDays < 0) {
|
||||||
|
return Qt.formatDateTime(root.selectedStartDate, "dd MMM yyyy")
|
||||||
|
}
|
||||||
|
// For future dates, show today first
|
||||||
|
return Qt.formatDateTime(new Date(), "dd MMM yyyy")
|
||||||
|
}
|
||||||
font.pointSize: Appearance.font.size.small
|
font.pointSize: Appearance.font.size.small
|
||||||
font.family: Appearance.font.family.mono
|
font.family: Appearance.font.family.mono
|
||||||
|
color: {
|
||||||
|
if (!root.hasSelection) return Colours.palette.m3onSurface
|
||||||
|
const today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate())
|
||||||
|
const selected = new Date(root.selectedStartDate.getFullYear(), root.selectedStartDate.getMonth(), root.selectedStartDate.getDate())
|
||||||
|
const diffDays = Math.round((selected - today) / (1000 * 60 * 60 * 24))
|
||||||
|
return diffDays < 0 ? Colours.palette.m3primary : Colours.palette.m3onSurface
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arrow and selected date (when applicable)
|
// Arrow and second date (when applicable)
|
||||||
Row {
|
Row {
|
||||||
visible: root.hasSelection
|
visible: root.hasSelection
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
@ -105,10 +128,30 @@ Column {
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: Qt.formatDateTime(root.selectedStartDate, "dd MMM yyyy")
|
text: {
|
||||||
|
if (!root.hasSelection) return ""
|
||||||
|
|
||||||
|
const today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate())
|
||||||
|
const selected = new Date(root.selectedStartDate.getFullYear(), root.selectedStartDate.getMonth(), root.selectedStartDate.getDate())
|
||||||
|
const diffDays = Math.round((selected - today) / (1000 * 60 * 60 * 24))
|
||||||
|
|
||||||
|
// For past dates, show today second
|
||||||
|
if (diffDays < 0) {
|
||||||
|
return Qt.formatDateTime(new Date(), "dd MMM yyyy")
|
||||||
|
}
|
||||||
|
// For future dates, show selected date second
|
||||||
|
return Qt.formatDateTime(root.selectedStartDate, "dd MMM yyyy")
|
||||||
|
}
|
||||||
font.pointSize: Appearance.font.size.small
|
font.pointSize: Appearance.font.size.small
|
||||||
font.family: Appearance.font.family.mono
|
font.family: Appearance.font.family.mono
|
||||||
color: Colours.palette.m3primary
|
color: {
|
||||||
|
if (!root.hasSelection) return Colours.palette.m3onSurface
|
||||||
|
const today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate())
|
||||||
|
const selected = new Date(root.selectedStartDate.getFullYear(), root.selectedStartDate.getMonth(), root.selectedStartDate.getDate())
|
||||||
|
const diffDays = Math.round((selected - today) / (1000 * 60 * 60 * 24))
|
||||||
|
return diffDays < 0 ? Colours.palette.m3onSurface : Colours.palette.m3primary
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue