T16 review fixes: an unknown system zone stops instead of reading as UTC, the view window refits when data shrinks, the volume profile counts narrow and flat candles whole, Fibonacci labels stay in their pane, the DOM ladder shows its tick's decimals, the tape flashes on each new trade, typed numbers reach their owner before a press, and a smaller loss than expected reads as a beat
This commit is contained in:
14 files changed
+230
-65
No files matched your search
@@ -173,6 +173,13 @@ pub fn relative(then: Timestamp, now: Timestamp) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// The system's time zone for `user`. An unknown zone stops here rather than reading as UTC.
|
||||
pub(crate) fn system_zone(user: &str) -> TimeZone {
|
||||
TimeZone::try_system().unwrap_or_else(|error| {
|
||||
panic!("{user}: the system time zone is unknown ({error}); pass a zone")
|
||||
})
|
||||
}
|
||||
|
||||
/// strftime in `zone`; a bad pattern is an error.
|
||||
pub fn datetime(at: Timestamp, zone: &TimeZone, pattern: &str) -> Result<String, jiff::Error> {
|
||||
strtime::format(pattern, &at.to_zoned(zone.clone()))
|
||||
|
||||
@@ -229,9 +229,7 @@ impl RenderOnce for DateTimeText {
|
||||
fn render(self, _: &mut Window, _: &mut App) -> impl IntoElement {
|
||||
let zone = match self.zone {
|
||||
Some(zone) => zone,
|
||||
None => TimeZone::try_system().unwrap_or_else(|error| {
|
||||
panic!("DateTimeText: system time zone unknown ({error}); pass .zone()")
|
||||
}),
|
||||
None => format::system_zone("DateTimeText"),
|
||||
};
|
||||
let text = format::datetime(self.at, &zone, self.pattern)
|
||||
.unwrap_or_else(|error| panic!("DateTimeText pattern {:?}: {error}", self.pattern));
|
||||
|
||||
Reference in new issue
Block a user