2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Display date of birth in user profiles.

This commit is contained in:
John Preston
2024-03-22 19:12:11 +04:00
parent c82d7bd909
commit 08ee25deb2
10 changed files with 166 additions and 22 deletions

View File

@@ -367,23 +367,9 @@ void SetupBirthday(
Info::Profile::BirthdayValue(self),
tr::lng_settings_birthday_add()
) | rpl::map([](Data::Birthday birthday, const QString &add) {
const auto wrap = &Ui::Text::WithEntities;
if (const auto year = birthday.year()) {
return wrap(tr::lng_month_day_year(
tr::now,
lt_month,
Lang::MonthSmall(birthday.month())(tr::now),
lt_day,
QString::number(birthday.day()),
lt_year,
QString::number(year)));
} else if (birthday) {
return wrap(tr::lng_month_day(
tr::now,
lt_month,
Lang::MonthSmall(birthday.month())(tr::now),
lt_day,
QString::number(birthday.day())));
const auto text = Data::BirthdayText(birthday);
if (!text.isEmpty()) {
return TextWithEntities{ text };
}
auto result = TextWithEntities{ add };
result.entities.push_back({