Add an undo button to the git panel (#24593)
Also prep infrastructure for pushing a commit Release Notes: - N/A --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Conrad <conrad@zed.dev> Co-authored-by: Nate Butler <iamnbutler@gmail.com>
This commit is contained in:
parent
df8adc8b11
commit
b014afa938
41 changed files with 1437 additions and 738 deletions
|
@ -24,19 +24,21 @@ pub fn format_localized_timestamp(
|
|||
) -> String {
|
||||
let timestamp_local = timestamp.to_offset(timezone);
|
||||
let reference_local = reference.to_offset(timezone);
|
||||
format_local_timestamp(timestamp_local, reference_local, format)
|
||||
}
|
||||
|
||||
/// Formats a timestamp, which respects the user's date and time preferences/custom format.
|
||||
pub fn format_local_timestamp(
|
||||
timestamp: OffsetDateTime,
|
||||
reference: OffsetDateTime,
|
||||
format: TimestampFormat,
|
||||
) -> String {
|
||||
match format {
|
||||
TimestampFormat::Absolute => {
|
||||
format_absolute_timestamp(timestamp_local, reference_local, false)
|
||||
}
|
||||
TimestampFormat::EnhancedAbsolute => {
|
||||
format_absolute_timestamp(timestamp_local, reference_local, true)
|
||||
}
|
||||
TimestampFormat::MediumAbsolute => {
|
||||
format_absolute_timestamp_medium(timestamp_local, reference_local)
|
||||
}
|
||||
TimestampFormat::Relative => format_relative_time(timestamp_local, reference_local)
|
||||
.unwrap_or_else(|| format_relative_date(timestamp_local, reference_local)),
|
||||
TimestampFormat::Absolute => format_absolute_timestamp(timestamp, reference, false),
|
||||
TimestampFormat::EnhancedAbsolute => format_absolute_timestamp(timestamp, reference, true),
|
||||
TimestampFormat::MediumAbsolute => format_absolute_timestamp_medium(timestamp, reference),
|
||||
TimestampFormat::Relative => format_relative_time(timestamp, reference)
|
||||
.unwrap_or_else(|| format_relative_date(timestamp, reference)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue