Просмотр исходного кода

fix(ui): improve zh duration display formatting (#10844)

Max Kong 3 недель назад
Родитель
Сommit
90a7e3d64e
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      packages/ui/src/components/session-turn.tsx

+ 3 - 1
packages/ui/src/components/session-turn.tsx

@@ -390,12 +390,14 @@ export function SessionTurn(
     const interval = Interval.fromDateTimes(from, to)
     const unit: DurationUnit[] = interval.length("seconds") > 60 ? ["minutes", "seconds"] : ["seconds"]
 
-    return interval.toDuration(unit).normalize().reconfigure({ locale: i18n.locale() }).toHuman({
+    const locale = i18n.locale()
+    const human = interval.toDuration(unit).normalize().reconfigure({ locale }).toHuman({
       notation: "compact",
       unitDisplay: "narrow",
       compactDisplay: "short",
       showZeros: false,
     })
+    return locale.startsWith("zh") ? human.replaceAll("、", "") : human
   }
 
   const autoScroll = createAutoScroll({