This commit is contained in:
Darius Constantin 2025-12-23 14:50:11 +07:00 committed by GitHub
commit beec54f108
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {