all repos — searchix @ 297a7a2096a12e6ac50d7b2077f2d75a7026fae4

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: improve display of indexing times and durations
Alan Pearce alan@alanpearce.eu
Sun, 23 Mar 2025 12:49:46 +0100
commit

297a7a2096a12e6ac50d7b2077f2d75a7026fae4

parent

7d4ff28794fcc8d7dd8c87f300ce6a6235f87cc5

1 files changed, 7 insertions(+), 7 deletions(-)

jump to
M internal/components/search.gointernal/components/search.go
@@ -45,7 +45,7 @@ P(Class("notice"), 				g.Text("Indexing in progress, started "),
 				Time(
 					DateTime(Indexing.StartedAt.Format(time.RFC3339)),
-					Title(Indexing.StartedAt.Format(time.RFC3339)),
+					Title(Indexing.StartedAt.Format(time.DateTime)),
 					g.Text(time.Since(Indexing.StartedAt).Round(time.Second).String()),
 				),
 				g.Text(" ago. "),
@@ -53,7 +53,7 @@ g.If(!Indexing.FinishedAt.IsZero(), 					g.Text("Last run took "),
 					Time(
 						DateTime(Indexing.FinishedAt.Format(time.RFC3339)),
-						Title(Indexing.FinishedAt.Format(time.RFC3339)),
+						Title(Indexing.FinishedAt.Format(time.DateTime)),
 						g.Text(time.Since(Indexing.FinishedAt).Round(time.Minute).String()),
 					),
 				),
@@ -62,14 +62,14 @@ P( 				g.Text("Indexing last ran "),
 				Time(
 					DateTime(Indexing.FinishedAt.Format(time.RFC3339)),
-					Title(Indexing.FinishedAt.Format(time.RFC3339)),
-					g.Text(time.Since(Indexing.FinishedAt).Round(time.Minute).String()),
+					Title(Indexing.FinishedAt.Format(time.DateTime)),
+					g.Textf("%.0f hours ago", time.Since(Indexing.FinishedAt).Hours()),
 				),
-				g.Text(" ago, will run again in "),
+				g.Text(", will run again in "),
 				Time(
 					DateTime(Indexing.NextRun.Format(time.RFC3339)),
-					Title(Indexing.NextRun.Format(time.RFC3339)),
-					g.Text(time.Until(Indexing.NextRun).Round(time.Minute).String()),
+					Title(Indexing.NextRun.Format(time.DateTime)),
+					g.Textf("%.0f hours", time.Until(Indexing.NextRun).Hours()),
 				),
 				g.Text("."),
 			),