complete tz implementation

This commit is contained in:
Emil Lerch 2026-01-04 23:00:35 -08:00
parent 54b0cffd4f
commit b7b0e506a9
Signed by: lobo
GPG key ID: A7B62D657EF764F8
4 changed files with 26 additions and 62 deletions

View file

@ -10,6 +10,7 @@ This directory contains comprehensive documentation for rewriting wttr.in in Zig
- Caching system
- GeoIP database integration (libmaxminddb)
- Location resolver with multiple input types
- Weather provider (Met.no) with timezone-aware forecasts; core data structures use zeit.Time/zeit.Date for type-safe date/time handling
- Output formats: ANSI, line (1-4), JSON (j1), v2 data-rich, custom (%)
- Query parameter parsing
- Static help pages (/:help, /:translation)

View file

@ -1227,7 +1227,7 @@ test "ansi format - MetNo real data - phoenix" {
const output = try render(allocator, weather_data, .{ .format = .ansi, .days = 3, .use_imperial = true });
defer allocator.free(output);
const expected = @embedFile("../tests/metno-phoenix-tmp.ansi");
const expected = @embedFile("../tests/metno-phoenix.ansi");
try std.testing.expectEqualStrings(expected, output);
}

View file

@ -1,38 +0,0 @@
Weather report: 33.4484,-112.0741
Cloudy
 .--.  +61(+61) °F
 .-( ).  ↘ 2 mph
 (___.__)__) 
0.0 in
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Sat 3 Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│ │ │ Cloudy │ Cloudy │
│ │ │  .--.  +61(+61) °F │  .--.  +59(+59) °F │
│ │ │  .-( ).  ↘ 2 mph │  .-( ).  ↑ 1 mph │
│ │ │  (___.__)__)  │  (___.__)__)  │
│ │ │ 0.0 in | 0% │ 0.0 in | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Sun 4 Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
 \ / Partly cloudy │  \ /  Clear │  \ / Fair │ Cloudy │
 _ /"".-.  +50(+50) °F │  .-.  +65(+65) °F │  _ /"".-.  +65(+65) °F │  .--.  +59(+59) °F │
 \_( ).  ↖ 3 mph │  ― ( ) ―  ↖ 3 mph │  \_( ).  ↙ 3 mph │  .-( ).  ↗ 1 mph │
 /(___(__)  │  `-'  │  /(___(__)  │  (___.__)__)  │
│ 0.0 in | 0% │  / \  0.0 in | 0% │ 0.0 in | 0% │ 0.0 in | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Mon 5 Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
 \ / Partly cloudy │  \ / Partly cloudy │  \ / Partly cloudy │ Cloudy │
 _ /"".-.  +51(+51) °F │  _ /"".-.  +64(+64) °F │  _ /"".-.  +63(+63) °F │  .--.  +56(+56) °F │
 \_( ).  ↖ 3 mph │  \_( ).  ↖ 2 mph │  \_( ).  ↓ 2 mph │  .-( ).  ↖ 2 mph │
 /(___(__)  │  /(___(__)  │  /(___(__)  │  (___.__)__)  │
│ 0.0 in | 0% │ 0.0 in | 0% │ 0.0 in | 0% │ 0.0 in | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘

View file

@ -1,37 +1,38 @@
Weather report: 33.4484,-112.0741
 \ / Partly cloudy
 _ /"".-.  64 °F
 \_( ).  ↘ 2 mph
 /(___(__)  9 mi
0.0 in
Cloudy
 .--.  +61(+61) °F
 .-( ).  ↘ 2 mph
 (___.__)__) 
0.0 in
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Sat 03 Jan ├───────────────────────┬──────────────────────────────┐
┌──────────────────────────────┬───────────────────────┤ Sat 3 Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
 \ /  Sunny │  \ /  Sunny │  \ /  Clear │  \ /  Clear
 .-.  53 °F │  .-.  69 °F │  .-.  +75(77) °F │  .-.  62 °F
 ― ( ) ―  ↙ 3-5 mph │  ― ( ) ―  ← 3-4 mph │  ― ( ) ―  ↗ 1 mph │  ― ( ) ―  ↘ 1-3 mph
 `-  6 mi │  `-  6 mi │  `-  6 mi │  `-  6 mi
 / \  0.0 in | 0% │  / \  0.0 in | 0% │  / \  0.0 in | 0% │  / \  0.0 in | 0%
│ │ Cloudy │ Cloudy
│ │  .--.  +61(+61) °F │  .--.  +59(+59) °F
│ │  .-( ).  ↘ 2 mph │  .-( ).  ↑ 1 mph
│ │  (___.__)__)  │  (___.__)__) 
│ │ 0.0 in | 0% │ 0.0 in | 0%
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Sun 04 Jan ├───────────────────────┬──────────────────────────────┐
┌──────────────────────────────┬───────────────────────┤ Sun 4 Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
Cloudy │  \ /  Sunny │  \ /  Clear │  \ /  Clear
 .--.  55 °F │  .-.  62 °F │  .-.  69 °F │  .-.  62 °F
 .-( ).  → 1-3 mph │  ― ( ) ―  ↖ 3 mph │  ― ( ) ―  → 3-4 mph │  ― ( ) ―  ↑ 1-3 mph
 (___.__)__)  6 mi │  `-  6 mi │  `-  6 mi │  `-  6 mi
│ 0.0 in | 0% │  / \  0.0 in | 0% │  / \  0.0 in | 0% │  / \  0.0 in | 0%
 \ / Partly cloudy │  \ /  Clear │  \ / Fair │ Cloudy
 _ /"".-.  +50(+50) °F │  .-.  +65(+65) °F │  _ /"".-.  +65(+65) °F │  .--.  +59(+59) °F
 \_( ).  ↖ 3 mph │  ― ( ) ―  ↖ 3 mph │  \_( ).  ↙ 3 mph │  .-( ).  ↗ 1 mph
 /(___(__)  │  `-'  │  /(___(__)  │  (___.__)__) 
│ 0.0 in | 0% / \  0.0 in | 0% │ 0.0 in | 0% │ 0.0 in | 0%
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Mon 05 Jan ├───────────────────────┬──────────────────────────────┐
┌──────────────────────────────┬───────────────────────┤ Mon 5 Jan ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
Overcast │ Overcast │  \ /  Clear │  \ /  Clear
 .--.  59 °F │  .--.  62 °F │  .-.  66 °F │  .-.  60 °F
 .-( ).  ↗ 4-6 mph │  .-( ).  ↗ 2-3 mph │  ― ( ) ―  → 5-6 mph │  ― ( ) ―  ↘ 1-3 mph
 (___.__)__)  6 mi │  (___.__)__)  6 mi │  `-  6 mi │  `-  6 mi
│ 0.0 in | 0% │ 0.0 in | 0% │  / \  0.0 in | 0% │  / \  0.0 in | 0%
 \ / Partly cloudy │  \ / Partly cloudy │  \ / Partly cloudy │ Cloudy
 _ /"".-.  +51(+51) °F │  _ /"".-.  +64(+64) °F │  _ /"".-.  +63(+63) °F │  .--.  +56(+56) °F
 \_( ).  ↖ 3 mph │  \_( ).  ↖ 2 mph │  \_( ).  ↓ 2 mph │  .-( ).  ↖ 2 mph
 /(___(__)  │  /(___(__)  │  /(___(__)  │  (___.__)__) 
│ 0.0 in | 0% │ 0.0 in | 0% │ 0.0 in | 0% │ 0.0 in | 0%
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘