From: Claudio Cambra Date: Mon, 7 Aug 2023 11:41:24 +0000 (+0800) Subject: Stop reducing date numbers X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~9^2~7^2~23 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e7343a17ea8a56435553567f2abaf1b6aeb644d4;p=nextcloud-desktop.git Stop reducing date numbers Signed-off-by: Claudio Cambra --- diff --git a/src/gui/filedetails/NCInputDateField.qml b/src/gui/filedetails/NCInputDateField.qml index bba717e83..73a0a369d 100644 --- a/src/gui/filedetails/NCInputDateField.qml +++ b/src/gui/filedetails/NCInputDateField.qml @@ -12,9 +12,6 @@ * for more details. */ -// QML dates are essentially JavaScript dates, which makes them very finicky and unreliable. -// Instead, we exclusively deal with msecs from epoch time to make things less painful when editing. -// We only use the QML Date when showing the nice string to the user. NCInputTextField { id: root @@ -88,29 +85,14 @@ NCInputTextField { } property var date: new Date().getTime() * 1000 // QDateTime msecsFromEpoch + onDateChanged: updateText() + property var minimumDate: 0 property var maximumDate: Number.MAX_SAFE_INTEGER - // Work arounds the limitations of QML's 32 bit integer when handling msecs from epoch - // Instead, we handle everything as days since epoch - readonly property int _dayInMSecs: 24 * 60 * 60 * 1000 - readonly property int _expireDateReduced: Math.floor(root.date / dayInMSecs) - // Reset the model data after binding broken on user interact - onExpireDateReducedChanged: { - value = expireDateReduced; - updateText(); - } - - readonly property int _maximumExpireDateReduced: Math.floor(maximumDate / dayInMSecs) - readonly property int _minimumExpireDateReduced: Math.floor(minimumDate / dayInMSecs) - - readonly property var _from: minimumExpireDateReduced - readonly property var _to: maximumExpireDateReduced - readonly property var _value: expireDateReduced - validInput: { const value = valueFromText(text); - return value >= _from && value <= _to; + return value >= minimumDate && value <= maximumDate; } text: _textFromValue(_value, locale)