Limits on Time Zone Representation in brew info JSON
0 reputation · 22 Apr 2020, 10:04 UTC
0 reputation · 22 Apr 2020, 10:04 UTC
The brew info --json=v2 command exposes created_at and updated_at fields as ISO 8601 strings ending with a Z, indicating UTC. Homebrew’s documentation states that these timestamps are not adjusted for the user’s local time zone.
It is unclear whether Homebrew will ever support a local‑time view of these fields or provide an option to convert them client‑side. This limitation can lead to confusion when interpreting formula history across different regions.
brew info that outputs timestamps in the user’s local time zone?created_at and updated_at in the JSON API?Homebrew’s brew info --json=v2 always emits created_at and updated_at as UTC ISO‑8601 strings (ending with Z). There is currently no flag to change this to the user’s local time zone, and no public roadmap item promises such a feature in the near term. Until a native option appears, the safest approach is to perform a client‑side conversion in your consuming code.
brew info --json=v2 | jq '.[0].created_at'
# Expected output: "2023-08-15T12:34:56Z"
const dt = new Date(json.created_at); // parsed as UTC
const local = dt.toLocaleString();
Or in Python:
from datetime import datetime, timezone
created = datetime.fromisoformat(json['created_at'].replace('Z', '+00:00'))
local = created.astimezone() # local system zone
--local-time flag by checking the JSON schema for a new field or by attempting to call brew info --help and parsing the output.If you suspect a change is imminent or want to influence the roadmap, open a GitHub issue in the Homebrew repo asking for clarification on a local‑time option. The maintainers will typically respond if such a feature is planned.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.