oz / tz

🌐 A time zone helper
GNU General Public License v3.0
849 stars 33 forks source link

Cannot show UNIX epoch with `-when 0` #71

Open jnd-au opened 1 week ago

jnd-au commented 1 week ago

Currently tz -when 0 will show the current (real) time instead of the UNIX epoch 0. This is a counter-intuitive and unfortunate. It would be good if -when 0 works the same way as -when 1 and -when -1. It would also be nice if ISO 8601/RFC 3339 date-times could be parsed, as this means tz would become quite versatile for developers to see and convert between seconds and timestamps.

oz commented 1 week ago

If we add support for RFC3339 dates, we're opening the door to many many more human friendly (and non-human friendly) representations too. Like + 1 week, +1d, years, days, or all of go's time durations, and the many incompatible date formats in existence.

Relying on established tools like date works fine.

jnd-au commented 1 week ago

Okay, but hopefully you will reconsider the latter. ISO 8601 / RFC 3339 are standard and common, not random, and it would be good for tz to support at least one standard, international, platform-independent format. UNIX seconds are a platform-specific notion, and as you noted above, date isn’t even standard between GNU/Linux and BSD. UNIX seconds are especially inconvenient and unintuitive for Windows users, who face multiple steps to use -when with PowerShell e.g. have to convert the time to UTC, then convert to UNIX seconds, then trim the fractional part because tz won’t parse it.