BlueGit

ict rusty-teams

fix(chat): message times keep the chosen 12- or 24-hour format (#158)

metis Hung Do · pushed by metis

Authored 2026-11-28 · 2 days ago

Hash
3b60e2c1077e42d2a0c9846b7a1159e6802d068d
Parent
08cf519e
2 files changed +5 −1
crates/app-base/src/format.rs +2 −1
@@ -69,7 +69,8 @@ pub fn set_date_locale(locale: Option<&str>) {
69 69 set_date_style(locale.map(date_style));
70 70 }
71 71
72 fn current_date_style() -> Option<DateStyle> {
72 /// The style set on this thread; work moved to another thread sets it there with [`set_date_style`].
73 pub fn current_date_style() -> Option<DateStyle> {
73 74 DATE_STYLE.with(Cell::get)
74 75 }
75 76
@@ -69,7 +69,8 @@ pub fn set_date_locale(locale: Option<&str>) {
69 set_date_style(locale.map(date_style));
69 set_date_style(locale.map(date_style));
70}
70}
71
71
72fn current_date_style() -> Option<DateStyle> {
72/// The style set on this thread; work moved to another thread sets it there with [`set_date_style`].
73pub fn current_date_style() -> Option<DateStyle> {
73 DATE_STYLE.with(Cell::get)
74 DATE_STYLE.with(Cell::get)
74}
75}
75
76
crates/app/src/views/conversation.rs +3 −0
@@ -1890,6 +1890,7 @@ impl ConversationView {
1890 1890 self.rebuild_generation += 1;
1891 1891 let generation = self.rebuild_generation;
1892 1892 let store = self.app.read(cx).store.clone();
1893 let date_style = app_base::format::current_date_style();
1893 1894 cx.spawn(async move |this, cx| {
1894 1895 let (plan, loaded) = cx
1895 1896 .background_spawn(async move {
@@ -1905,6 +1906,8 @@ impl ConversationView {
1905 1906 };
1906 1907 let (plan, loaded, context, built) = cx
1907 1908 .background_spawn(async move {
1909 // The regional format is per thread: without it the times fall back to 24 h.
1910 app_base::format::set_date_style(date_style);
1908 1911 let built = build_rows(&plan, &loaded, &context);
1909 1912 (plan, loaded, context, built)
1910 1913 })
@@ -1890,6 +1890,7 @@ impl ConversationView {
1890 self.rebuild_generation += 1;
1890 self.rebuild_generation += 1;
1891 let generation = self.rebuild_generation;
1891 let generation = self.rebuild_generation;
1892 let store = self.app.read(cx).store.clone();
1892 let store = self.app.read(cx).store.clone();
1893 let date_style = app_base::format::current_date_style();
1893 cx.spawn(async move |this, cx| {
1894 cx.spawn(async move |this, cx| {
1894 let (plan, loaded) = cx
1895 let (plan, loaded) = cx
1895 .background_spawn(async move {
1896 .background_spawn(async move {
@@ -1905,6 +1906,8 @@ impl ConversationView {
1905 };
1906 };
1906 let (plan, loaded, context, built) = cx
1907 let (plan, loaded, context, built) = cx
1907 .background_spawn(async move {
1908 .background_spawn(async move {
1909 // The regional format is per thread: without it the times fall back to 24 h.
1910 app_base::format::set_date_style(date_style);
1908 let built = build_rows(&plan, &loaded, &context);
1911 let built = build_rows(&plan, &loaded, &context);
1909 (plan, loaded, context, built)
1912 (plan, loaded, context, built)
1910 })
1913 })