cockpit-project / cockpit-machines

Cockpit UI for virtual machines
GNU Lesser General Public License v2.1
257 stars 67 forks source link

Show snapshot creation date as time delta #1694

Closed martinpitt closed 1 week ago

martinpitt commented 2 weeks ago

We use timeformat.distanceToNow() in most places in cockpit. Use that for consistency rather than showing a fuzzified absolut/relative time stamp mix with date-fn's formatRelative(). For more precision, show the absolute creation time in a tooltip.

This weans cockpit-machines off the date-fns API, which we try to get rid of (https://github.com/cockpit-project/cockpit/issues/20653).


Current main:

snapshots-main

This PR:

snap-pr

martinpitt commented 2 weeks ago

The tests still need updating, but I'd appreciate a first review if this approach is ok or we should rebuild the quasi-absolute relative/fuzzy formatRelative() in terms of Intl.

garrett commented 2 weeks ago

I guess the layout issues in the first screenshot aren't addressed, and it's just coincidence that it's not so broken in the second screenshot?

martinpitt commented 2 weeks ago

@garrett Right, this changes no layout at all. I just took the screenshots at different resolutions because reasons (mostly because firefox screenshots don't catch tooltips, so I did a full-screen snapshot). This is just about the time format.

martinpitt commented 1 week ago

@jelly As Katerina and Garrett already acked this, I'll leave the review to you -- I think you had some criticism?

jelly commented 1 week ago

@jelly As Katerina and Garrett already acked this, I'll leave the review to you -- I think you had some criticism?

I thought Garrett would have objections, if its fine with him lets merge it.