Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
libcore: Friendlier friendly time format
  • Loading branch information
skyjake committed Nov 9, 2018
1 parent a00d371 commit 1ce44e5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion doomsday/sdk/libcore/src/data/time.cpp
Expand Up @@ -327,7 +327,19 @@ String Time::asText(Format format) const
}
else if (format == FriendlyFormat)
{
return d->dateTime.toString(Qt::TextDate);
// Is it today?
if (d->dateTime.date() == QDateTime::currentDateTime().date())
{
return d->dateTime.toString("HH:mm");
}
else if (d->dateTime.date().year() == QDateTime::currentDateTime().date().year())
{
return d->dateTime.toString("MMM dd HH:mm");
}
else
{
return d->dateTime.toString("YYYY MMM dd");
}
}
else if (format == BuildNumberAndSecondsSinceStart ||
format == SecondsSinceStart)
Expand Down

0 comments on commit 1ce44e5

Please sign in to comment.