fix(chat): message times keep the chosen 12- or 24-hour format (#158)
@@ -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
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
DATE_STYLE.with(Cell::get)74
DATE_STYLE.with(Cell::get)74
}75
}75
76
@@ -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) = cx1895
let (plan, loaded) = cx1895
.background_spawn(async move {1896
.background_spawn(async move {@@ -1905,6 +1906,8 @@ impl ConversationView {1905
};1906
};1906
let (plan, loaded, context, built) = cx1907
let (plan, loaded, context, built) = cx1907
.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
})