Revert "Improve time handling in NeoChat"
This reverts commit 92c58b0ea0.
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2026 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
#include "neochatdatetime.h"
|
||||
|
||||
#include <KFormat>
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
NeoChatDateTime::NeoChatDateTime(QDateTime dateTime)
|
||||
: m_dateTime(dateTime)
|
||||
{
|
||||
}
|
||||
|
||||
QDateTime NeoChatDateTime::dateTime() const
|
||||
{
|
||||
return m_dateTime;
|
||||
}
|
||||
|
||||
QString NeoChatDateTime::hourMinuteString() const
|
||||
{
|
||||
return m_dateTime.toLocalTime().toString(u"hh:mm"_s);
|
||||
}
|
||||
|
||||
QString NeoChatDateTime::shortDateTime() const
|
||||
{
|
||||
return QLocale().toString(m_dateTime.toLocalTime(), QLocale::ShortFormat);
|
||||
}
|
||||
|
||||
QString NeoChatDateTime::relativeDate() const
|
||||
{
|
||||
KFormat formatter;
|
||||
return formatter.formatRelativeDate(m_dateTime.toLocalTime().date(), QLocale::ShortFormat);
|
||||
}
|
||||
|
||||
QString NeoChatDateTime::relativeDateTime() const
|
||||
{
|
||||
KFormat formatter;
|
||||
const auto relativePart = formatter.formatRelativeDate(m_dateTime.toLocalTime().date(), QLocale::ShortFormat);
|
||||
return u"%1, %2"_s.arg(relativePart, hourMinuteString());
|
||||
}
|
||||
|
||||
bool NeoChatDateTime::operator==(const QDateTime &right) const
|
||||
{
|
||||
return m_dateTime == right;
|
||||
}
|
||||
|
||||
#include "moc_neochatdatetime.cpp"
|
||||
Reference in New Issue
Block a user