MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / ParseRegistrationDate

Function ParseRegistrationDate

Telegram/SourceFiles/data/data_peer.cpp:71–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71[[nodiscard]] int ParseRegistrationDate(const QString &text) {
72 // MM.YYYY
73 if (text.size() != 7 || text[2] != '.') {
74 return 0;
75 }
76 const auto month = text.mid(0, 2).toInt();
77 const auto year = text.mid(3, 4).toInt();
78 return (year > 2012 && year < 2100 && month > 0 && month <= 12)
79 ? (year * 100) + month
80 : 0;
81}
82
83[[nodiscard]] int RegistrationYear(int date) {
84 const auto year = date / 100;

Callers 1

setBarSettingsMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected