public void GeoTimezoneInfo_ByTZID() { // given a TZ ID, find the right GeoTimezone object and check its properties foreach (var tz in GeoTimezoneInfo.Windows) { var g = GeoTimezoneInfo.ByTZID(tz.TZID.ToLowerInvariant()); Assert.IsNotNull(g); Assert.AreEqual(tz.TZID, g.TZID); } }
public GeoTimezoneInfo GuessTimezone(GeoCountryInfo country) { if (country == null) { return(null); } switch (country.ISO2) { case "AR": return(GeoTimezoneInfo.ByTZID("America/Buenos_Aires")); case "CL": return(GeoTimezoneInfo.ByTZID("America/Santiago")); case "JP": return(GeoTimezoneInfo.ByTZID("Asia/Tokyo")); case "NZ": return(GeoTimezoneInfo.ByTZID("Pacific/Auckland")); case "CH": return(GeoTimezoneInfo.ByTZID("Europe/Zurich")); default: return(null); } }
// -------------------------------------------------- // Timezone public GeoTimezoneInfo LookupTimezone(IGeoLatLon point) { var response = _google.RequestTimezone(point); return(GeoTimezoneInfo.ByTZID(response.TimeZoneId)); }