Skip to content

Commit 18a7705

Browse files
committed
Rename "timezone-display::name" to "id"
Other possibilities: "tzid", "iana-id", "identifier", "iana-identifier". Returning a user-displayable name as part of timezone-display would require more information: the user's preferred language, and the preferred style for the name: - abbreviated or not - year-round or specific to the Instant E.g., the time zone with the IANA id "America/Los_Angeles" might be displayed as "Pacific Time", "Pacific Standard Time", "Pacific Daylight Time", "PT", "PST", "PDT", "Nordamerikanische Westküstenzeit"... The Rust iana_time_zone crate uses IANA time zone IDs, so if this interface needs to be able to implement iana_time_zone, timezone-display should have an IANA ID and not a user-displayable name.
1 parent 525dd13 commit 18a7705

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ default-monotonic-clock: monotonic-clock
9696

9797
let timezone_display: TimezoneDisplay = timezone::display(instant);
9898

99-
println!("the timezone is {}", timezone_display.name);
99+
println!("the timezone is {}", timezone_display.id);
100100
```
101101

102102
### Detailed design discussion

wit-0.3.0-draft/timezone.wit

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,18 @@ interface timezone {
3232
/// should return 0.
3333
utc-offset: s32,
3434

35-
/// The abbreviated name of the timezone to display to a user. The name
36-
/// `UTC` indicates Coordinated Universal Time. Otherwise, this should
37-
/// reference local standards for the name of the time zone.
35+
/// The IANA identifier of the timezone. The id `UTC` indicates
36+
/// Coordinated Universal Time. Otherwise, this should be an identifier
37+
/// from the IANA Time Zone Database.
38+
///
39+
/// For displaying to a user, the identifier should be converted into a
40+
/// localized name by means of an internationalization API.
3841
///
3942
/// In implementations that do not expose an actual time zone, this
4043
/// should be the string `UTC`.
4144
///
4245
/// In time zones that do not have an applicable name, a formatted
4346
/// representation of the UTC offset may be returned, such as `-04:00`.
44-
name: string,
47+
id: string,
4548
}
4649
}

0 commit comments

Comments
 (0)