The viewer's "x years ago" info sucks ;-)

Tobias Leupold tl at stonemx.de
Sun Apr 9 11:39:52 BST 2023


Hi all and happy easter :-)

I was (if you believe it or not) just actually USING KPhotoAlbum, to view old 
easter photos. I noticed one thing:

- For easter 2022 (2022-04-17), I get "11 months ago"
- For easter 2021 (2021-04-04), I get "2 years ago"
- For easter 2020 (2020-04-12), I get "2 years ago"
- For easter 2019 (2019-04-21), I get "3 years ago"

You see the problem?

What I would expect to get is something like that:

- For easter 2022 "ca. 1 year ago"
- For easter 2021 "ca. 2 years ago"
- For easter 2020 "ca. 3 years ago"
- For easter 2019 "ca. 4 years ago"

The longer the date is in the past, the more it's not about the date being 
exactly one day after the date in question or not. Easter 2019 IS four years 
ago, even if the photos have been taken on April 21, and now we only have 
April 9.

It's completely clear to me that the displayed age used for ages of persons 
has to be day-correct, e. g. if I was on a photo on October 25 last year, a 
few days before my birthday, I was 39 at the time and not 40.

But for an image "taken x years ago", the current behavior looks more like a 
bug than like a feature.

We should really change this.

For durations that are less than e.g. 2 years ago, we should add exacter 
descriptions, like "1 year and 10 months ago". But as the distance grows, we 
need to be more fuzzy. Like "Ca. 2 years ago", even if we are like one month 
off. We could also add some classification like "x 1/4", "x 1/2" and "x 3/4", 
with proper ranges. And with added attributes like "Ca." and "Almost". Of 
course, we also need the "Exact" case, for some fixed date (like Christmas or 
such).

IIRC, I worked on that some time ago (cf. https://bugreports.qt.io/browse/
QTBUG-77721 ), but my code either didn't make it into KPA or was removed again 
later on.

However, I think that the current state of how we do it is quite messy. 
Looking into Utilities/DescriptionUtil.cpp, multiple class definitions and 
implementations are mixed inside one cpp file, the code is really hard to read 
(at least for me), and I think the classes used don't really fit for what I 
would do.

I'm thinking of adding one more versatile "time interval" class that either 
can return an exact difference, or a fuzzy one, depending for what we want to 
use it. And there's as it seems only two cases: The age of some person in 
years, or a period of time that has passed since a photo has been taken.

Alas, there's still nothing like Python's datetime.timedelta in Qt 5 (and 
possibly also not in Qt 6, but I didn't check this yet). So we're still on our 
own here.

What do you think?

Cheers, Tobias




More information about the KPhotoAlbum mailing list