1 | /* |
---|---|
2 | SPDX-FileCopyrightText: 2011 John Layt <john@layt.net> |
3 | SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org> |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #include "kdaterangecontrol_p.h" |
8 | |
9 | bool KDateRangeControlPrivate::isInDateRange(const QDate &date) const |
10 | { |
11 | return date.isValid() // |
12 | && (!m_minDate.isValid() || date >= m_minDate) // |
13 | && (!m_maxDate.isValid() || date <= m_maxDate); |
14 | } |
15 | |
16 | bool KDateRangeControlPrivate::setDateRange(const QDate &minDate, const QDate &maxDate) |
17 | { |
18 | if (minDate.isValid() && maxDate.isValid() && minDate > maxDate) { |
19 | return false; |
20 | } |
21 | |
22 | m_minDate = minDate; |
23 | m_maxDate = maxDate; |
24 | return true; |
25 | } |
26 |