mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Replace QString::mid with base::StringViewMid where QStringView is accepted
This commit is contained in:
parent
0d72d47318
commit
f3bda59019
1 changed files with 2 additions and 2 deletions
|
@ -235,7 +235,7 @@ ExpireDateValidationResult ValidateExpireDate(
|
||||||
return { ValidationState::Incomplete };
|
return { ValidationState::Incomplete };
|
||||||
}
|
}
|
||||||
const auto normalized = (sanitized[0] > '1' ? "0" : "") + sanitized;
|
const auto normalized = (sanitized[0] > '1' ? "0" : "") + sanitized;
|
||||||
const auto month = normalized.mid(0, 2).toInt();
|
const auto month = base::StringViewMid(normalized, 0, 2).toInt();
|
||||||
if (month < 1 || month > 12) {
|
if (month < 1 || month > 12) {
|
||||||
return { ValidationState::Invalid };
|
return { ValidationState::Invalid };
|
||||||
} else if (normalized.size() < 4) {
|
} else if (normalized.size() < 4) {
|
||||||
|
@ -243,7 +243,7 @@ ExpireDateValidationResult ValidateExpireDate(
|
||||||
} else if (normalized.size() > 4) {
|
} else if (normalized.size() > 4) {
|
||||||
return { ValidationState::Invalid };
|
return { ValidationState::Invalid };
|
||||||
}
|
}
|
||||||
const auto year = 2000 + normalized.mid(2).toInt();
|
const auto year = 2000 + base::StringViewMid(normalized, 2).toInt();
|
||||||
|
|
||||||
const auto thresholdDate = overrideExpireDateThreshold.value_or(
|
const auto thresholdDate = overrideExpireDateThreshold.value_or(
|
||||||
QDate::currentDate());
|
QDate::currentDate());
|
||||||
|
|
Loading…
Add table
Reference in a new issue