Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Friendly time is silly for longer periods #9897

Closed
mrclay opened this issue Jun 14, 2016 · 9 comments
Closed

Friendly time is silly for longer periods #9897

mrclay opened this issue Jun 14, 2016 · 9 comments

Comments

@mrclay
Copy link
Member

mrclay commented Jun 14, 2016

Describing times as "2142 days ago" is embarrassingly bad UX. When these are seen in a meeting they're rightfully mocked.

After 30 days: "May 14"
After a year: "June 2015"

@iionly
Copy link
Contributor

iionly commented Jun 14, 2016

so something like https://elgg.org/plugins/869364

@jdalsem
Copy link
Member

jdalsem commented Jun 15, 2016

Yep... switching to dates after a certain period makes more sense...

@propertunist
Copy link

the problem with using dates is that there is no support for local time in elgg. so you will always see the time for the timezone that the server is configured for. without adding support for local time, my only suggestion is to add different time periods to the friendly time label system. e.g. instead of 366 days ago, you would see '1 year and 1 day ago' or something similar. each site will have different requirements and some might prefer to just see '1 year ago' and leave out the number of days.

@jdalsem
Copy link
Member

jdalsem commented Jun 15, 2016

We currently already show the textual date as a mouseover... the timezone issue is real, but could be separated from this issue... momentjs comes to mind

@propertunist
Copy link

right ok. i just tested iionly's plugin and i agree, it solves the problem since it doesn't display times with the dates. the other versions of the friendly time plugins i have used were showing times too.

@iionly
Copy link
Contributor

iionly commented Jun 15, 2016

Even when not showing the time but only the date there would still be the same possible error with timezones not showing the correct date if you expect the output to take into account your local timezone (that might be more or less different to the server time). But I think this is a matter for a different issue because the friendly time output is first of all a matter of output format. As long as timezones support is not implemented the output format can be switched depending on the time difference between now and an items creation/modification time in many ways. The question is if this adjustment is to be added to core as a new feature or if it would be enough to refer to a 3rd party plugin that uses the 'format', 'friendly:time' hook to do this job.

Additionally, Elgg supporting different timezones for every users is a much larger issue to deal with (as you not only have to take into the account the details of output but also date/time input of users because these data might also be displayed using friendly time views). The output of user input with taking into account timezones might be a major hassle though. Think about existing content that has been saved without a timezone shift or think about a user changing the user-specific timezone. Could get quite messy. But I think it's really something for a separate issue (if there's not yet such an issue). After timezone support would be implemented it might be necessary to make adjustments in the friendly time output (or just in the data available in the hook) if Elgg core does output more than just "X days ago". Additionally output formats taking into account the user language might be nice to have then, too.

@mrclay
Copy link
Member Author

mrclay commented Sep 23, 2016

More Elgg/www.elgg.org#66

@juho-jaakkola
Copy link
Member

juho-jaakkola commented Sep 24, 2016

Crazy idea: Let's allow language files to define the full format.

This could be anything supported by date() function, e.g. "F Y" (January 2016):

$format = elgg_echo('friendlytime:format:within_year');

All textual representations (in this case "F") are parsed from the $format and replaced by translated strings:

if (strpos('F', $format) !== false) {
    $month_number = date('m', $time);
    $replacement = elgg_echo("date:month:$month_number");
}

For this we would need a class that maps date format characters to the translations and performs the replacement.

@mrclay
Copy link
Member Author

mrclay commented Sep 24, 2016

language files to define the full format

Feels like something for site settings. Let's ask @beck24 or his coworker if he knows how Drupal handle date formatting + I18N.

@jdalsem jdalsem added this to the Elgg 3.0.x milestone Nov 9, 2017
jdalsem added a commit to jdalsem/Elgg that referenced this issue Dec 8, 2017
The amount of days can be configured by the site admin.

Fixes Elgg#9897
@jdalsem jdalsem mentioned this issue Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants