Soenneker.TimeZones.Lookup
4.0.98
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.TimeZones.Lookup --version 4.0.98
NuGet\Install-Package Soenneker.TimeZones.Lookup -Version 4.0.98
<PackageReference Include="Soenneker.TimeZones.Lookup" Version="4.0.98" />
<PackageVersion Include="Soenneker.TimeZones.Lookup" Version="4.0.98" />
<PackageReference Include="Soenneker.TimeZones.Lookup" />
paket add Soenneker.TimeZones.Lookup --version 4.0.98
#r "nuget: Soenneker.TimeZones.Lookup, 4.0.98"
#:package Soenneker.TimeZones.Lookup@4.0.98
#addin nuget:?package=Soenneker.TimeZones.Lookup&version=4.0.98
#tool nuget:?package=Soenneker.TimeZones.Lookup&version=4.0.98
Soenneker.TimeZones.Lookup
Resolves latitude and longitude coordinates to IANA time-zone identifiers using a packaged GeoJSON boundary dataset.
Installation
dotnet add package Soenneker.TimeZones.Lookup
The lookup package references Soenneker.TimeZones.Data, so the default boundary resource is included automatically.
Registration
using Soenneker.TimeZones.Lookup.Registrars;
builder.Services.AddTimeZoneLookupUtilAsSingleton();
The singleton registration is recommended for most applications because the parsed geographic features are loaded once and retained for later lookups. A scoped registrar is available when isolation is more important than repeating that memory and parse cost per scope.
Usage
using Soenneker.TimeZones.Lookup.Abstract;
public sealed class LocationService(ITimeZoneLookupUtil timeZones)
{
public ValueTask<string?> GetZone(
double latitude,
double longitude,
CancellationToken cancellationToken = default)
{
return timeZones.GetTimeZoneId(latitude, longitude, cancellationToken);
}
}
string? zone = await locationService.GetZone(41.8781, -87.6298);
// America/Chicago
Pass latitude first and longitude second. Latitude must be from -90 through 90 and longitude from -180 through 180; invalid values throw ArgumentOutOfRangeException. A valid coordinate returns null when no dataset polygon contains it, such as an uncovered ocean coordinate.
Loading behavior
The first lookup parses the GeoJSON and caches the resulting features for that TimeZoneLookupUtil instance. Concurrent callers share that initialization. Cancellation can stop the initial load; once loaded, lookups operate on the in-memory geometry.
The public constructor overload accepting a stream factory supports a custom GeoJSON dataset. The factory must return a readable stream containing a FeatureCollection; the loader owns and disposes the returned stream after parsing. Features use properties.tzid and Polygon or MultiPolygon geometry.
Coordinates on a polygon edge count as contained. If the dataset contains overlapping zones, the first matching feature determines the result.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Soenneker.TimeZones.Data (>= 4.0.116)
- Soenneker.Utils.File (>= 4.0.2241)
- Soenneker.Utils.Paths.Resources (>= 4.0.226)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.TimeZones.Lookup:
| Package | Downloads |
|---|---|
|
Soenneker.ZipCodes.Lookup
Fast ZipCode Resolution for .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.102 | 0 | 9/1/2026 |
| 4.0.101 | 0 | 9/1/2026 |
| 4.0.100 | 0 | 8/31/2026 |
| 4.0.99 | 0 | 8/31/2026 |
| 4.0.98 | 20 | 8/31/2026 |
| 4.0.97 | 30 | 8/31/2026 |
| 4.0.96 | 50 | 8/30/2026 |
| 4.0.95 | 43 | 8/30/2026 |
| 4.0.94 | 48 | 8/30/2026 |
| 4.0.93 | 46 | 8/29/2026 |
| 4.0.92 | 44 | 8/29/2026 |
| 4.0.91 | 109 | 8/28/2026 |
| 4.0.90 | 73 | 8/26/2026 |
| 4.0.89 | 50 | 8/26/2026 |
| 4.0.88 | 52 | 8/26/2026 |
| 4.0.87 | 128 | 8/22/2026 |
| 4.0.86 | 97 | 8/22/2026 |
| 4.0.85 | 97 | 8/22/2026 |
| 4.0.84 | 89 | 8/21/2026 |
| 4.0.83 | 116 | 8/21/2026 |