Default the CLI to the system time zone

It shipped with America/Denver hardcoded, taken from what dominates the
historical data on the server. That data is old; the reader has moved.
A zone belongs to whoever is looking at the calendar, and baking one in is
the same mistake as v1's offset-instead-of-zone in miniature -- it looks
right until the reader is somewhere else.

Falls back to UTC rather than to a populated guess: an obviously neutral
wrong answer gets noticed, a plausible one does not.
This commit is contained in:
2026-08-26 15:38:55 -04:00
parent f8e4a497fa
commit c197e08af0
4 changed files with 19 additions and 1 deletions
+1
View File
@@ -11,6 +11,7 @@ runway-caldav = { workspace = true }
chrono = { workspace = true }
chrono-tz = { workspace = true }
clap = { workspace = true }
iana-time-zone = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
+16 -1
View File
@@ -33,13 +33,28 @@ struct Cli {
password: String,
/// The zone to show times in, and to read floating times as.
#[arg(long, default_value = "America/Denver")]
///
/// Defaults to whatever the machine is set to. Baking in a zone would be
/// the same mistake in miniature that this project exists to correct: the
/// right zone is a property of the reader, and readers move.
#[arg(long, default_value_t = local_timezone())]
timezone: Tz,
#[command(subcommand)]
command: Command,
}
/// The system's own IANA zone, falling back to UTC when it cannot be read.
///
/// UTC rather than a guess at somewhere populated: a wrong zone that looks
/// plausible is worse than an obviously neutral one, because nobody checks it.
fn local_timezone() -> Tz {
iana_time_zone::get_timezone()
.ok()
.and_then(|name| name.parse().ok())
.unwrap_or(Tz::UTC)
}
#[derive(Subcommand)]
enum Command {
/// List the calendars the server offers.