Browse Source

Fix wrong date in history view when looking at labeled version (#27450)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
GitOrigin-RevId: 87b6f82e3024334d03991db794dd11301918245e
Alf Eaton 1 năm trước cách đây
mục cha
commit
c83c04b8b2

+ 8 - 4
services/web/frontend/js/features/history/components/change-list/label-list-item.tsx

@@ -47,10 +47,14 @@ function LabelListItem({
 }: LabelListItemProps) {
   const { t } = useTranslation()
 
-  // first label
-  const fromVTimestamp = Date.parse(labels[labels.length - 1].created_at)
-  // most recent label
-  const toVTimestamp = Date.parse(labels[0].created_at)
+  // first label - use the actual version timestamp, fallback to created_at if not available
+  const fromLabel = labels[labels.length - 1]
+  const fromVTimestamp =
+    fromLabel.lastUpdatedTimestamp ?? Date.parse(fromLabel.created_at)
+  // most recent label - use the actual version timestamp, fallback to created_at if not available
+  const toLabel = labels[0]
+  const toVTimestamp =
+    toLabel.lastUpdatedTimestamp ?? Date.parse(toLabel.created_at)
 
   const updateRange: UpdateRange = {
     fromV: version,