git_graph: Show time in commit details (#62679)
# Objective The Git Graph list shows the full commit timestamp in its constrained date column, while the more spacious commit details view only shows the calendar date. Include the time in the details view so it does not provide less information than the graph itself. ## Solution Reuse the existing `format_timestamp` helper from the Git Graph `Date` column when rendering the selected commit details. This gives both views the same local date and time format without a separate formatting path. ## Testing - `cargo check -p git_ui` ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Improved Git Graph commit details to show the same full commit timestamp as the `Date` column. Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
1 parent
d4424eec68
commit
fad8515a7a
1 file changed
+1
-12
@@ -2740,18 +2740,7 @@ impl GitGraph {
|
||||
CommitDataState::Loading(_) => ("Loading…".into(), "".into(), None),
|
||||
};
|
||||
|
||||
let date_string = commit_timestamp
|
||||
.and_then(|ts| OffsetDateTime::from_unix_timestamp(ts).ok())
|
||||
.map(|datetime| {
|
||||
let local_offset = UtcOffset::current_local_offset().unwrap_or(UtcOffset::UTC);
|
||||
let local_datetime = datetime.to_offset(local_offset);
|
||||
let format =
|
||||
time::format_description::parse("[month repr:short] [day], [year]").ok();
|
||||
format
|
||||
.and_then(|f| local_datetime.format(&f).ok())
|
||||
.unwrap_or_default()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let date_string = commit_timestamp.map(format_timestamp).unwrap_or_default();
|
||||
|
||||
let remote = repository.update(cx, |repo, cx| {
|
||||
let remote_url = repo.default_remote_url()?;
|
||||
|
||||
Reference in new issue
Block a user