BlueGit

ict rusty-teams

fix(format): every clock follows the display language like Teams

- new format::clock_format(); message, toast, agenda, status, reminder, schedule and recap times use it
- en-US accounts see 1:45 PM everywhere, 24-hour languages unchanged
- 12-hour agenda times stack start over end so the column does not wrap

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-07 · 3 weeks ago

Hash
e798bbed297cb2e90968a7d8541f5c1df4ead80c
Parent
770376ee
16 files changed +88 −32
crates/app-base/src/format.rs +14 −0
@@ -29,6 +29,10 @@ fn current_date_style() -> Option<DateStyle> {
29 29 DATE_STYLE.with(Cell::get)
30 30 }
31 31
32 pub fn clock_format() -> &'static str {
33 current_date_style().map_or("%H:%M", |style| style.clock)
34 }
35
32 36 /// Numeric day and month in the order of the account's display language, as `Intl.DateTimeFormat` does in Teams.
33 37 pub fn date_style(locale: &str) -> DateStyle {
34 38 let locale = locale.to_ascii_lowercase();
@@ -219,6 +223,16 @@ mod tests {
219 223
220 224 use super::*;
221 225
226 #[test]
227 fn the_clock_follows_the_display_language() {
228 set_date_locale(Some("en-US"));
229 assert_eq!(clock_format(), "%-I:%M %p");
230 set_date_locale(Some("de-DE"));
231 assert_eq!(clock_format(), "%H:%M");
232 set_date_locale(None);
233 assert_eq!(clock_format(), "%H:%M");
234 }
235
222 236 fn utc(day: u32, hour: u32) -> DateTime<Utc> {
223 237 Utc.with_ymd_and_hms(2026, 10, day, hour, 5, 0).unwrap()
224 238 }
@@ -29,6 +29,10 @@ fn current_date_style() -> Option<DateStyle> {
29 DATE_STYLE.with(Cell::get)
29 DATE_STYLE.with(Cell::get)
30}
30}
31
31
32pub fn clock_format() -> &'static str {
33 current_date_style().map_or("%H:%M", |style| style.clock)
34}
35
32/// Numeric day and month in the order of the account's display language, as `Intl.DateTimeFormat` does in Teams.
36/// Numeric day and month in the order of the account's display language, as `Intl.DateTimeFormat` does in Teams.
33pub fn date_style(locale: &str) -> DateStyle {
37pub fn date_style(locale: &str) -> DateStyle {
34 let locale = locale.to_ascii_lowercase();
38 let locale = locale.to_ascii_lowercase();
@@ -219,6 +223,16 @@ mod tests {
219
223
220 use super::*;
224 use super::*;
221
225
226 #[test]
227 fn the_clock_follows_the_display_language() {
228 set_date_locale(Some("en-US"));
229 assert_eq!(clock_format(), "%-I:%M %p");
230 set_date_locale(Some("de-DE"));
231 assert_eq!(clock_format(), "%H:%M");
232 set_date_locale(None);
233 assert_eq!(clock_format(), "%H:%M");
234 }
235
222 fn utc(day: u32, hour: u32) -> DateTime<Utc> {
236 fn utc(day: u32, hour: u32) -> DateTime<Utc> {
223 Utc.with_ymd_and_hms(2026, 10, day, hour, 5, 0).unwrap()
237 Utc.with_ymd_and_hms(2026, 10, day, hour, 5, 0).unwrap()
224 }
238 }
crates/app-base/src/recap.rs +6 −2
@@ -78,7 +78,7 @@ pub fn occurrence_label(
78 78 format!(
79 79 "{}, {}",
80 80 format::day_label(local.date_naive(), today),
81 local.format("%H:%M")
81 local.format(format::clock_format())
82 82 )
83 83 },
84 84 )
@@ -87,7 +87,11 @@ pub fn occurrence_label(
87 87 pub fn time_label(time: Option<DateTime<Utc>>, offset: FixedOffset) -> String {
88 88 time.map_or_else(
89 89 || "-".to_owned(),
90 |time| time.with_timezone(&offset).format("%H:%M").to_string(),
90 |time| {
91 time.with_timezone(&offset)
92 .format(format::clock_format())
93 .to_string()
94 },
91 95 )
92 96 }
93 97
@@ -78,7 +78,7 @@ pub fn occurrence_label(
78 format!(
78 format!(
79 "{}, {}",
79 "{}, {}",
80 format::day_label(local.date_naive(), today),
80 format::day_label(local.date_naive(), today),
81 local.format("%H:%M")
81 local.format(format::clock_format())
82 )
82 )
83 },
83 },
84 )
84 )
@@ -87,7 +87,11 @@ pub fn occurrence_label(
87pub fn time_label(time: Option<DateTime<Utc>>, offset: FixedOffset) -> String {
87pub fn time_label(time: Option<DateTime<Utc>>, offset: FixedOffset) -> String {
88 time.map_or_else(
88 time.map_or_else(
89 || "-".to_owned(),
89 || "-".to_owned(),
90 |time| time.with_timezone(&offset).format("%H:%M").to_string(),
90 |time| {
91 time.with_timezone(&offset)
92 .format(format::clock_format())
93 .to_string()
94 },
91 )
95 )
92}
96}
93
97
crates/app-base/src/schedule_time.rs +13 −5
@@ -88,7 +88,7 @@ pub fn presets(now: DateTime<Local>) -> Vec<Preset> {
88 88 presets.push(Preset {
89 89 kind: PresetKind::LaterToday,
90 90 label: "Later today",
91 time_label: at.format("%H:%M").to_string(),
91 time_label: at.format(crate::format::clock_format()).to_string(),
92 92 at,
93 93 });
94 94 }
@@ -111,7 +111,7 @@ pub fn presets(now: DateTime<Local>) -> Vec<Preset> {
111 111 presets.push(Preset {
112 112 kind,
113 113 label,
114 time_label: at.format("%a %H:%M").to_string(),
114 time_label: weekday_clock(at),
115 115 at,
116 116 });
117 117 }
@@ -175,12 +175,20 @@ pub fn format_time(time: NaiveTime) -> String {
175 175 pub fn describe(at: DateTime<Local>, now: DateTime<Local>) -> String {
176 176 let days_ahead = (at.date_naive() - now.date_naive()).num_days();
177 177 match days_ahead {
178 0 => at.format("today %H:%M").to_string(),
179 1..=6 => at.format("%a %H:%M").to_string(),
180 _ => at.format("%a %-d %b %H:%M").to_string(),
178 0 => format!("today {}", at.format(crate::format::clock_format())),
179 1..=6 => weekday_clock(at),
180 _ => format!(
181 "{} {}",
182 at.format("%a %-d %b"),
183 at.format(crate::format::clock_format())
184 ),
181 185 }
182 186 }
183 187
188 fn weekday_clock(at: DateTime<Local>) -> String {
189 format!("{} {}", at.format("%a"), at.format(crate::format::clock_format()))
190 }
191
184 192 #[cfg(test)]
185 193 mod tests {
186 194 use super::*;
@@ -88,7 +88,7 @@ pub fn presets(now: DateTime<Local>) -> Vec<Preset> {
88 presets.push(Preset {
88 presets.push(Preset {
89 kind: PresetKind::LaterToday,
89 kind: PresetKind::LaterToday,
90 label: "Later today",
90 label: "Later today",
91 time_label: at.format("%H:%M").to_string(),
91 time_label: at.format(crate::format::clock_format()).to_string(),
92 at,
92 at,
93 });
93 });
94 }
94 }
@@ -111,7 +111,7 @@ pub fn presets(now: DateTime<Local>) -> Vec<Preset> {
111 presets.push(Preset {
111 presets.push(Preset {
112 kind,
112 kind,
113 label,
113 label,
114 time_label: at.format("%a %H:%M").to_string(),
114 time_label: weekday_clock(at),
115 at,
115 at,
116 });
116 });
117 }
117 }
@@ -175,12 +175,20 @@ pub fn format_time(time: NaiveTime) -> String {
175pub fn describe(at: DateTime<Local>, now: DateTime<Local>) -> String {
175pub fn describe(at: DateTime<Local>, now: DateTime<Local>) -> String {
176 let days_ahead = (at.date_naive() - now.date_naive()).num_days();
176 let days_ahead = (at.date_naive() - now.date_naive()).num_days();
177 match days_ahead {
177 match days_ahead {
178 0 => at.format("today %H:%M").to_string(),
178 0 => format!("today {}", at.format(crate::format::clock_format())),
179 1..=6 => at.format("%a %H:%M").to_string(),
179 1..=6 => weekday_clock(at),
180 _ => at.format("%a %-d %b %H:%M").to_string(),
180 _ => format!(
181 "{} {}",
182 at.format("%a %-d %b"),
183 at.format(crate::format::clock_format())
184 ),
181 }
185 }
182}
186}
183
187
188fn weekday_clock(at: DateTime<Local>) -> String {
189 format!("{} {}", at.format("%a"), at.format(crate::format::clock_format()))
190}
191
184#[cfg(test)]
192#[cfg(test)]
185mod tests {
193mod tests {
186 use super::*;
194 use super::*;
crates/app-call-model/src/agenda.rs +2 −2
@@ -78,8 +78,8 @@ fn time_label(event: &CalendarEvent, offset: FixedOffset) -> String {
78 78 }
79 79 format!(
80 80 "{} - {}",
81 event.start.with_timezone(&offset).format("%H:%M"),
82 event.end.with_timezone(&offset).format("%H:%M")
81 event.start.with_timezone(&offset).format(app_base::format::clock_format()),
82 event.end.with_timezone(&offset).format(app_base::format::clock_format())
83 83 )
84 84 }
85 85
@@ -78,8 +78,8 @@ fn time_label(event: &CalendarEvent, offset: FixedOffset) -> String {
78 }
78 }
79 format!(
79 format!(
80 "{} - {}",
80 "{} - {}",
81 event.start.with_timezone(&offset).format("%H:%M"),
81 event.start.with_timezone(&offset).format(app_base::format::clock_format()),
82 event.end.with_timezone(&offset).format("%H:%M")
82 event.end.with_timezone(&offset).format(app_base::format::clock_format())
83 )
83 )
84}
84}
85
85
crates/app-state/src/call/reminder.rs +1 −1
@@ -73,7 +73,7 @@ pub struct ReminderUpdate {
73 73 }
74 74
75 75 pub fn subtitle(toast: &MeetingToast, now: DateTime<Utc>, offset: FixedOffset) -> String {
76 let clock = toast.start.with_timezone(&offset).format("%H:%M");
76 let clock = toast.start.with_timezone(&offset).format(app_base::format::clock_format());
77 77 match toast.phase {
78 78 ReminderPhase::Started => format!("{clock} - started"),
79 79 ReminderPhase::Live => format!("{clock} - live now"),
@@ -73,7 +73,7 @@ pub struct ReminderUpdate {
73}
73}
74
74
75pub fn subtitle(toast: &MeetingToast, now: DateTime<Utc>, offset: FixedOffset) -> String {
75pub fn subtitle(toast: &MeetingToast, now: DateTime<Utc>, offset: FixedOffset) -> String {
76 let clock = toast.start.with_timezone(&offset).format("%H:%M");
76 let clock = toast.start.with_timezone(&offset).format(app_base::format::clock_format());
77 match toast.phase {
77 match toast.phase {
78 ReminderPhase::Started => format!("{clock} - started"),
78 ReminderPhase::Started => format!("{clock} - started"),
79 ReminderPhase::Live => format!("{clock} - live now"),
79 ReminderPhase::Live => format!("{clock} - live now"),
crates/app-state/src/call_rows.rs +8 −5
@@ -9,8 +9,7 @@ use crate::format;
9 9
10 10 const MAX_AVATARS: usize = 4;
11 11 const RECAP_FALLBACK_TITLE: &str = "Meeting";
12 const RECAP_DATE_FORMAT: &str = "%A, %-d %B %Y %H:%M";
13 const RECAP_TIME_FORMAT: &str = "%H:%M";
12 const RECAP_DATE_FORMAT: &str = "%A, %-d %B %Y";
14 13 const AUTO_STOP_SECONDS: i64 = 5;
15 14 const WEEKDAY_STAMP_DAYS: i64 = 6;
16 15 const OWN_NAME: &str = "You";
@@ -324,10 +323,10 @@ fn recap_date_line(
324 323 "{} - {}",
325 324 slot.start
326 325 .with_timezone(&clock.offset)
327 .format(RECAP_DATE_FORMAT),
326 .format(&format!("{RECAP_DATE_FORMAT} {}", app_base::format::clock_format())),
328 327 slot.end
329 328 .with_timezone(&clock.offset)
330 .format(RECAP_TIME_FORMAT)
329 .format(app_base::format::clock_format())
331 330 )
332 331 }
333 332
@@ -336,7 +335,11 @@ fn notice_stamp(time: DateTime<Utc>, clock: &CallClock) -> String {
336 335 let local = time.with_timezone(&clock.offset);
337 336 let days_ago = (clock.today - local.date_naive()).num_days();
338 337 if (2..=WEEKDAY_STAMP_DAYS).contains(&days_ago) {
339 local.format("%A %H:%M").to_string()
338 format!(
339 "{} {}",
340 local.format("%A"),
341 local.format(app_base::format::clock_format())
342 )
340 343 } else {
341 344 format::post_time_label(time, clock.today, clock.offset)
342 345 }
@@ -9,8 +9,7 @@ use crate::format;
9
9
10const MAX_AVATARS: usize = 4;
10const MAX_AVATARS: usize = 4;
11const RECAP_FALLBACK_TITLE: &str = "Meeting";
11const RECAP_FALLBACK_TITLE: &str = "Meeting";
12const RECAP_DATE_FORMAT: &str = "%A, %-d %B %Y %H:%M";
12const RECAP_DATE_FORMAT: &str = "%A, %-d %B %Y";
13const RECAP_TIME_FORMAT: &str = "%H:%M";
14const AUTO_STOP_SECONDS: i64 = 5;
13const AUTO_STOP_SECONDS: i64 = 5;
15const WEEKDAY_STAMP_DAYS: i64 = 6;
14const WEEKDAY_STAMP_DAYS: i64 = 6;
16const OWN_NAME: &str = "You";
15const OWN_NAME: &str = "You";
@@ -324,10 +323,10 @@ fn recap_date_line(
324 "{} - {}",
323 "{} - {}",
325 slot.start
324 slot.start
326 .with_timezone(&clock.offset)
325 .with_timezone(&clock.offset)
327 .format(RECAP_DATE_FORMAT),
326 .format(&format!("{RECAP_DATE_FORMAT} {}", app_base::format::clock_format())),
328 slot.end
327 slot.end
329 .with_timezone(&clock.offset)
328 .with_timezone(&clock.offset)
330 .format(RECAP_TIME_FORMAT)
329 .format(app_base::format::clock_format())
331 )
330 )
332}
331}
333
332
@@ -336,7 +335,11 @@ fn notice_stamp(time: DateTime<Utc>, clock: &CallClock) -> String {
336 let local = time.with_timezone(&clock.offset);
335 let local = time.with_timezone(&clock.offset);
337 let days_ago = (clock.today - local.date_naive()).num_days();
336 let days_ago = (clock.today - local.date_naive()).num_days();
338 if (2..=WEEKDAY_STAMP_DAYS).contains(&days_ago) {
337 if (2..=WEEKDAY_STAMP_DAYS).contains(&days_ago) {
339 local.format("%A %H:%M").to_string()
338 format!(
339 "{} {}",
340 local.format("%A"),
341 local.format(app_base::format::clock_format())
342 )
340 } else {
343 } else {
341 format::post_time_label(time, clock.today, clock.offset)
344 format::post_time_label(time, clock.today, clock.offset)
342 }
345 }
crates/app-state/src/connection_banner.rs +1 −1
@@ -58,7 +58,7 @@ pub fn banner_text(kind: BannerKind, last_sync: Option<DateTime<Utc>>) -> Banner
58 58 BannerKind::Reconnecting => text("Reconnecting..."),
59 59 BannerKind::Offline => BannerText {
60 60 detail: last_sync
61 .map(|time| format!("Last synced {}", time.with_timezone(&Local).format("%H:%M"))),
61 .map(|time| format!("Last synced {}", time.with_timezone(&Local).format(app_base::format::clock_format()))),
62 62 ..text(OFFLINE_TEXT)
63 63 },
64 64 BannerKind::SignIn => text("Sign-in required. Sign in to Teams in the window that opened."),
@@ -58,7 +58,7 @@ pub fn banner_text(kind: BannerKind, last_sync: Option<DateTime<Utc>>) -> Banner
58 BannerKind::Reconnecting => text("Reconnecting..."),
58 BannerKind::Reconnecting => text("Reconnecting..."),
59 BannerKind::Offline => BannerText {
59 BannerKind::Offline => BannerText {
60 detail: last_sync
60 detail: last_sync
61 .map(|time| format!("Last synced {}", time.with_timezone(&Local).format("%H:%M"))),
61 .map(|time| format!("Last synced {}", time.with_timezone(&Local).format(app_base::format::clock_format()))),
62 ..text(OFFLINE_TEXT)
62 ..text(OFFLINE_TEXT)
63 },
63 },
64 BannerKind::SignIn => text("Sign-in required. Sign in to Teams in the window that opened."),
64 BannerKind::SignIn => text("Sign-in required. Sign in to Teams in the window that opened."),
crates/app-state/src/own_status.rs +6 −2
@@ -160,9 +160,13 @@ where
160 160 {
161 161 let local = expires_at.with_timezone(&now.timezone());
162 162 if local.date_naive() == now.date_naive() {
163 format!("until {}", local.format("%H:%M"))
163 format!("until {}", local.format(app_base::format::clock_format()))
164 164 } else {
165 format!("until {}", local.format("%a %H:%M"))
165 format!(
166 "until {} {}",
167 local.format("%a"),
168 local.format(app_base::format::clock_format())
169 )
166 170 }
167 171 }
168 172
@@ -160,9 +160,13 @@ where
160{
160{
161 let local = expires_at.with_timezone(&now.timezone());
161 let local = expires_at.with_timezone(&now.timezone());
162 if local.date_naive() == now.date_naive() {
162 if local.date_naive() == now.date_naive() {
163 format!("until {}", local.format("%H:%M"))
163 format!("until {}", local.format(app_base::format::clock_format()))
164 } else {
164 } else {
165 format!("until {}", local.format("%a %H:%M"))
165 format!(
166 "until {} {}",
167 local.format("%a"),
168 local.format(app_base::format::clock_format())
169 )
166 }
170 }
167}
171}
168
172
crates/app-state/src/pending_rows.rs +4 −1
@@ -36,7 +36,10 @@ pub fn pending_row(
36 36 application_id: None,
37 37 created_at,
38 38 series: Series::default(),
39 time: created_at.with_timezone(&Local).format("%H:%M").to_string(),
39 time: created_at
40 .with_timezone(&Local)
41 .format(app_base::format::clock_format())
42 .to_string(),
40 43 day_header: None,
41 44 blocks: pending_blocks(outgoing),
42 45 jumbo: (outgoing.reply.is_none() && outgoing.images.is_empty() && outgoing.files.is_empty())
@@ -36,7 +36,10 @@ pub fn pending_row(
36 application_id: None,
36 application_id: None,
37 created_at,
37 created_at,
38 series: Series::default(),
38 series: Series::default(),
39 time: created_at.with_timezone(&Local).format("%H:%M").to_string(),
39 time: created_at
40 .with_timezone(&Local)
41 .format(app_base::format::clock_format())
42 .to_string(),
40 day_header: None,
43 day_header: None,
41 blocks: pending_blocks(outgoing),
44 blocks: pending_blocks(outgoing),
42 jumbo: (outgoing.reply.is_none() && outgoing.images.is_empty() && outgoing.files.is_empty())
45 jumbo: (outgoing.reply.is_none() && outgoing.images.is_empty() && outgoing.files.is_empty())
crates/app-state/src/profile_model.rs +1 −1
@@ -36,7 +36,7 @@ pub fn status_line(availability: &str, local_time: Option<&str>) -> String {
36 36
37 37 pub fn local_time_label(profile: &PersonProfile, now: DateTime<Utc>) -> Option<String> {
38 38 let zone = profile.time_zone.as_deref()?;
39 Some(local_time(zone, now)?.format("%H:%M").to_string())
39 Some(local_time(zone, now)?.format(app_base::format::clock_format()).to_string())
40 40 }
41 41
42 42 pub fn work_location_label(location: WorkLocation) -> &'static str {
@@ -36,7 +36,7 @@ pub fn status_line(availability: &str, local_time: Option<&str>) -> String {
36
36
37pub fn local_time_label(profile: &PersonProfile, now: DateTime<Utc>) -> Option<String> {
37pub fn local_time_label(profile: &PersonProfile, now: DateTime<Utc>) -> Option<String> {
38 let zone = profile.time_zone.as_deref()?;
38 let zone = profile.time_zone.as_deref()?;
39 Some(local_time(zone, now)?.format("%H:%M").to_string())
39 Some(local_time(zone, now)?.format(app_base::format::clock_format()).to_string())
40}
40}
41
41
42pub fn work_location_label(location: WorkLocation) -> &'static str {
42pub fn work_location_label(location: WorkLocation) -> &'static str {
crates/app-state/src/reaction_model.rs +1 −1
@@ -67,7 +67,7 @@ where
67 67 let local = time.with_timezone(&now.timezone());
68 68 let day = local.date_naive();
69 69 let today = now.date_naive();
70 let clock = local.format("%H:%M");
70 let clock = local.format(app_base::format::clock_format());
71 71 if day == today {
72 72 format!("today at {clock}")
73 73 } else if today.pred_opt() == Some(day) {
@@ -67,7 +67,7 @@ where
67 let local = time.with_timezone(&now.timezone());
67 let local = time.with_timezone(&now.timezone());
68 let day = local.date_naive();
68 let day = local.date_naive();
69 let today = now.date_naive();
69 let today = now.date_naive();
70 let clock = local.format("%H:%M");
70 let clock = local.format(app_base::format::clock_format());
71 if day == today {
71 if day == today {
72 format!("today at {clock}")
72 format!("today at {clock}")
73 } else if today.pred_opt() == Some(day) {
73 } else if today.pred_opt() == Some(day) {
crates/app-state/src/rows.rs +3 −1
@@ -381,7 +381,9 @@ pub struct Thread {
381 381 }
382 382
383 383 pub fn clock_label(time: DateTime<Utc>, offset: FixedOffset) -> String {
384 time.with_timezone(&offset).format("%H:%M").to_string()
384 time.with_timezone(&offset)
385 .format(app_base::format::clock_format())
386 .to_string()
385 387 }
386 388
387 389 pub fn reaction_label(reaction_type: &str) -> String {
@@ -381,7 +381,9 @@ pub struct Thread {
381}
381}
382
382
383pub fn clock_label(time: DateTime<Utc>, offset: FixedOffset) -> String {
383pub fn clock_label(time: DateTime<Utc>, offset: FixedOffset) -> String {
384 time.with_timezone(&offset).format("%H:%M").to_string()
384 time.with_timezone(&offset)
385 .format(app_base::format::clock_format())
386 .to_string()
385}
387}
386
388
387pub fn reaction_label(reaction_type: &str) -> String {
389pub fn reaction_label(reaction_type: &str) -> String {
crates/app/src/notify/center.rs +12 −4
@@ -497,7 +497,9 @@ impl NotificationCenter {
497 497 let now = Instant::now();
498 498 let outcome = self.stack.push(incoming, now);
499 499 if let Some(model) = self.stack.get_mut(outcome.id) {
500 model.time = chrono::Local::now().format("%H:%M").to_string();
500 model.time = chrono::Local::now()
501 .format(crate::format::clock_format())
502 .to_string();
501 503 }
502 504 let throttle_allows = self.throttle.allow(&incoming.conversation_id, now);
503 505 let audible =
@@ -534,7 +536,9 @@ impl NotificationCenter {
534 536 .stack
535 537 .push_status_change(user_id, &name, text, &conversation_id, Instant::now());
536 538 if let Some(model) = self.stack.get_mut(id) {
537 model.time = chrono::Local::now().format("%H:%M").to_string();
539 model.time = chrono::Local::now()
540 .format(crate::format::clock_format())
541 .to_string();
538 542 }
539 543 let user_id = user_id.to_owned();
540 544 self.app
@@ -577,7 +581,9 @@ impl NotificationCenter {
577 581 .stack
578 582 .push_agent(toast, &run.conversation_id, &run.message_id, now);
579 583 if let Some(model) = self.stack.get_mut(id) {
580 model.time = chrono::Local::now().format("%H:%M").to_string();
584 model.time = chrono::Local::now()
585 .format(crate::format::clock_format())
586 .to_string();
581 587 }
582 588 let quiet = self.settings.do_not_disturb || self.app.read(cx).mode.demo;
583 589 if self.settings.sounds.notification_sound && !quiet {
@@ -664,7 +670,9 @@ impl NotificationCenter {
664 670 Instant::now(),
665 671 );
666 672 if let Some(model) = self.stack.get_mut(id) {
667 model.time = chrono::Local::now().format("%H:%M").to_string();
673 model.time = chrono::Local::now()
674 .format(crate::format::clock_format())
675 .to_string();
668 676 }
669 677 if decision.sound && !self.demo_mode {
670 678 self.play_notification_sound(cx);
@@ -497,7 +497,9 @@ impl NotificationCenter {
497 let now = Instant::now();
497 let now = Instant::now();
498 let outcome = self.stack.push(incoming, now);
498 let outcome = self.stack.push(incoming, now);
499 if let Some(model) = self.stack.get_mut(outcome.id) {
499 if let Some(model) = self.stack.get_mut(outcome.id) {
500 model.time = chrono::Local::now().format("%H:%M").to_string();
500 model.time = chrono::Local::now()
501 .format(crate::format::clock_format())
502 .to_string();
501 }
503 }
502 let throttle_allows = self.throttle.allow(&incoming.conversation_id, now);
504 let throttle_allows = self.throttle.allow(&incoming.conversation_id, now);
503 let audible =
505 let audible =
@@ -534,7 +536,9 @@ impl NotificationCenter {
534 .stack
536 .stack
535 .push_status_change(user_id, &name, text, &conversation_id, Instant::now());
537 .push_status_change(user_id, &name, text, &conversation_id, Instant::now());
536 if let Some(model) = self.stack.get_mut(id) {
538 if let Some(model) = self.stack.get_mut(id) {
537 model.time = chrono::Local::now().format("%H:%M").to_string();
539 model.time = chrono::Local::now()
540 .format(crate::format::clock_format())
541 .to_string();
538 }
542 }
539 let user_id = user_id.to_owned();
543 let user_id = user_id.to_owned();
540 self.app
544 self.app
@@ -577,7 +581,9 @@ impl NotificationCenter {
577 .stack
581 .stack
578 .push_agent(toast, &run.conversation_id, &run.message_id, now);
582 .push_agent(toast, &run.conversation_id, &run.message_id, now);
579 if let Some(model) = self.stack.get_mut(id) {
583 if let Some(model) = self.stack.get_mut(id) {
580 model.time = chrono::Local::now().format("%H:%M").to_string();
584 model.time = chrono::Local::now()
585 .format(crate::format::clock_format())
586 .to_string();
581 }
587 }
582 let quiet = self.settings.do_not_disturb || self.app.read(cx).mode.demo;
588 let quiet = self.settings.do_not_disturb || self.app.read(cx).mode.demo;
583 if self.settings.sounds.notification_sound && !quiet {
589 if self.settings.sounds.notification_sound && !quiet {
@@ -664,7 +670,9 @@ impl NotificationCenter {
664 Instant::now(),
670 Instant::now(),
665 );
671 );
666 if let Some(model) = self.stack.get_mut(id) {
672 if let Some(model) = self.stack.get_mut(id) {
667 model.time = chrono::Local::now().format("%H:%M").to_string();
673 model.time = chrono::Local::now()
674 .format(crate::format::clock_format())
675 .to_string();
668 }
676 }
669 if decision.sound && !self.demo_mode {
677 if decision.sound && !self.demo_mode {
670 self.play_notification_sound(cx);
678 self.play_notification_sound(cx);
crates/app/src/views/activity_panel.rs +5 −3
@@ -612,12 +612,14 @@ where
612 612 Zone::Offset: std::fmt::Display,
613 613 {
614 614 let (start, end) = (start.with_timezone(zone), end.with_timezone(zone));
615 let clock = crate::format::clock_format();
616 let dated = format!("%b %-d, {clock}");
615 617 let end_format = if end.date_naive() == start.date_naive() {
616 "%H:%M"
618 clock
617 619 } else {
618 "%b %-d, %H:%M"
620 dated.as_str()
619 621 };
620 format!("{} - {}", start.format("%b %-d, %H:%M"), end.format(end_format))
622 format!("{} - {}", start.format(&dated), end.format(end_format))
621 623 }
622 624
623 625 fn reply_headline(entry: &Entry, names: &str) -> String {
@@ -612,12 +612,14 @@ where
612 Zone::Offset: std::fmt::Display,
612 Zone::Offset: std::fmt::Display,
613{
613{
614 let (start, end) = (start.with_timezone(zone), end.with_timezone(zone));
614 let (start, end) = (start.with_timezone(zone), end.with_timezone(zone));
615 let clock = crate::format::clock_format();
616 let dated = format!("%b %-d, {clock}");
615 let end_format = if end.date_naive() == start.date_naive() {
617 let end_format = if end.date_naive() == start.date_naive() {
616 "%H:%M"
618 clock
617 } else {
619 } else {
618 "%b %-d, %H:%M"
620 dated.as_str()
619 };
621 };
620 format!("{} - {}", start.format("%b %-d, %H:%M"), end.format(end_format))
622 format!("{} - {}", start.format(&dated), end.format(end_format))
621}
623}
622
624
623fn reply_headline(entry: &Entry, names: &str) -> String {
625fn reply_headline(entry: &Entry, names: &str) -> String {
crates/app/src/views/calls_tab.rs +10 −2
@@ -380,12 +380,12 @@ fn agenda_row(
380 380 .cursor_pointer()
381 381 .hover(|row| row.bg(theme::row_hover()))
382 382 .child(
383 div()
383 v_flex()
384 384 .w(px(TIME_COLUMN_WIDTH))
385 385 .flex_none()
386 386 .text_size(px(12.))
387 387 .text_color(theme::text_muted())
388 .child(row.time_label.clone()),
388 .children(time_lines(&row.time_label)),
389 389 )
390 390 .child(
391 391 v_flex()
@@ -518,3 +518,11 @@ pub fn calls_body(
518 518 ))
519 519 .into_any_element()
520 520 }
521
522 fn time_lines(label: &str) -> Vec<String> {
523 let twelve_hour = crate::format::clock_format().contains(['p', 'P']);
524 match label.split_once(" - ") {
525 Some((start, end)) if twelve_hour => vec![start.to_owned(), end.to_owned()],
526 _ => vec![label.to_owned()],
527 }
528 }
@@ -380,12 +380,12 @@ fn agenda_row(
380 .cursor_pointer()
380 .cursor_pointer()
381 .hover(|row| row.bg(theme::row_hover()))
381 .hover(|row| row.bg(theme::row_hover()))
382 .child(
382 .child(
383 div()
383 v_flex()
384 .w(px(TIME_COLUMN_WIDTH))
384 .w(px(TIME_COLUMN_WIDTH))
385 .flex_none()
385 .flex_none()
386 .text_size(px(12.))
386 .text_size(px(12.))
387 .text_color(theme::text_muted())
387 .text_color(theme::text_muted())
388 .child(row.time_label.clone()),
388 .children(time_lines(&row.time_label)),
389 )
389 )
390 .child(
390 .child(
391 v_flex()
391 v_flex()
@@ -518,3 +518,11 @@ pub fn calls_body(
518 ))
518 ))
519 .into_any_element()
519 .into_any_element()
520}
520}
521
522fn time_lines(label: &str) -> Vec<String> {
523 let twelve_hour = crate::format::clock_format().contains(['p', 'P']);
524 match label.split_once(" - ") {
525 Some((start, end)) if twelve_hour => vec![start.to_owned(), end.to_owned()],
526 _ => vec![label.to_owned()],
527 }
528}
crates/app/src/views/proposal_card.rs +1 −1
@@ -199,7 +199,7 @@ fn header_text(entry: &ProposalEntry, now: DateTime<Utc>) -> (String, Hsla, Opti
199 199 ProposalStatus::Stale { answered_at } => (
200 200 format!(
201 201 "{agent}'s reply is outdated - you answered at {}",
202 answered_at.format("%H:%M")
202 answered_at.format(crate::format::clock_format())
203 203 ),
204 204 theme::text_muted(),
205 205 None,
@@ -199,7 +199,7 @@ fn header_text(entry: &ProposalEntry, now: DateTime<Utc>) -> (String, Hsla, Opti
199 ProposalStatus::Stale { answered_at } => (
199 ProposalStatus::Stale { answered_at } => (
200 format!(
200 format!(
201 "{agent}'s reply is outdated - you answered at {}",
201 "{agent}'s reply is outdated - you answered at {}",
202 answered_at.format("%H:%M")
202 answered_at.format(crate::format::clock_format())
203 ),
203 ),
204 theme::text_muted(),
204 theme::text_muted(),
205 None,
205 None,