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

Change date display format for relative time/date #1071

Closed
alamp1360 opened this issue Oct 3, 2024 · 5 comments
Closed

Change date display format for relative time/date #1071

alamp1360 opened this issue Oct 3, 2024 · 5 comments

Comments

@alamp1360
Copy link

Icingaweb currently displays some dates in lists as a relative time, e.g. "1d 5h ago" or "on Sept 25".
When, for example, i try to find an alert in the "history" view of a service, that relative time display does not really help in finding an event. Instead, it is additional work to try (and fail) to recalculate the relative dates to an exact date.
Of course one could klick on an event to see the exact time, but that requires an extra step.

I guess one of you great developers of icingaweb2 invested a lot of time to realize that feature, but, at least for me it is not very helpful...
So i would suggest to implement some sort of "time display format" setting in the personal settings, where users could select either that relative format or an "exact timestamp".
My simple solution: Display a combination of the exact date and the relative time.
My "fix" would be something like this:

*** DateFormatter.php   2024-08-15 16:43:58.000000000 +0200
--- DateFormatter.php_new       2024-10-03 09:10:29.003981357 +0200
***************
*** 166,179 ****
                  // Move to next case
              case static::DATETIME:
                  $formatted = sprintf(
!                     t('on %s', 'An event happened on the given date or date and time'),
!                     $ago
                  );
                  break;
              case static::RELATIVE:
                  $formatted = sprintf(
!                     t('%s ago', 'An event that happened the given time interval ago'),
!                     $ago
                  );
                  break;
              case static::TIME:
--- 166,181 ----
                  // Move to next case
              case static::DATETIME:
                  $formatted = sprintf(
!                     t('%s (on %s)', 'An event happened on the given date or date and time'),
!                     date('Y-m-d H:i:s', (int) $time),
!                     $ago
                  );
                  break;
              case static::RELATIVE:
                  $formatted = sprintf(
!                     t('%s (%s ago)', 'An event that happened the given time interval ago'),
!                     date('Y-m-d H:i:s', (int) $time),
!                     $ago
                  );
                  break;
              case static::TIME:
@alamp1360
Copy link
Author

Seems this is no issue of icingaweb, but icingaweb-module-icingadb. Sorry for opening the issue here...

@lippserd
Copy link
Member

lippserd commented Oct 4, 2024

No worries, I will transfer. Since we have a lot of relative timestamps, are you also mainly referring to history views as in #1065?

@alamp1360
Copy link
Author

Yes, i am referring to the history view. And it seems i'm not the only one :)
However: The display format has changed "recently" from "1day 5 hours ago" to a more readable "on Oct 3 17:10". So it seems the issue was addressed already by some kind soul. From my point of view, with this recent change, the issue is gone.

@nilmerg
Copy link
Member

nilmerg commented Oct 7, 2024

What you've noticed is based on the time difference. If the time difference exceeds a given threshold, the relative format won't be used anymore automatically.

@nilmerg nilmerg transferred this issue from Icinga/icingaweb2 Oct 7, 2024
@nilmerg
Copy link
Member

nilmerg commented Oct 7, 2024

Duplicate of #1065

@nilmerg nilmerg marked this as a duplicate of #1065 Oct 7, 2024
@nilmerg nilmerg closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants