mirror of
https://github.com/uutils/coreutils.git
synced 2025-12-23 08:47:37 +00:00
Merge 96e553883c into 8d3774b67e
This commit is contained in:
commit
beec54f108
1 changed files with 7 additions and 2 deletions
|
|
@ -8,6 +8,7 @@
|
|||
mod locale;
|
||||
|
||||
use clap::{Arg, ArgAction, Command};
|
||||
use jiff::ToSpan;
|
||||
use jiff::fmt::strtime;
|
||||
use jiff::tz::{TimeZone, TimeZoneDatabase};
|
||||
use jiff::{Timestamp, Zoned};
|
||||
|
|
@ -308,8 +309,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
} else if let Some(total_hours) = military_tz_with_offset {
|
||||
// Military timezone with optional hour offset
|
||||
// Convert to UTC time: midnight + military_tz_offset + additional_hours
|
||||
let date_part =
|
||||
strtime::format("%F", &now).unwrap_or_else(|_| String::from("1970-01-01"));
|
||||
let yesterday = now.checked_sub(1.day());
|
||||
let date_part = match yesterday {
|
||||
Ok(yesterday) => strtime::format("%F", &yesterday)
|
||||
.unwrap_or_else(|_| String::from("1970-01-01")),
|
||||
Err(_) => String::from("1970-01-01"),
|
||||
};
|
||||
let composed = format!("{date_part} {total_hours:02}:00:00 +00:00");
|
||||
parse_date(composed)
|
||||
} else if is_pure_digits {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue