Commit 7a865827 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Show number of days ago the vaccination was

parent 14614ee5
Pipeline #104961 passed with stage
in 3 minutes and 13 seconds
......@@ -49,9 +49,16 @@ ColumnLayout {
}
QQC2.Label {
text: certificate.date.toLocaleDateString(Qt.locale(), Locale.ShortFormat)
readonly property int days: daysTo(certificate.date, new Date())
text: {
const formattedDate = certificate.date.toLocaleDateString(Qt.locale(), Locale.ShortFormat);
if (days > 0) {
return i18np("%2 (%1 day ago)", "%2 (%1 days ago)", days, formattedDate);
}
return formattedDate;
}
Kirigami.FormData.label: i18n("Date:")
color: daysTo(certificate.date, new Date()) >= 14 ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.neutralTextColor
color: days >= 14 ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.neutralTextColor
font.bold: true
visible: !isNaN(certificate.date.getTime())
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment