### Install TZFinder Builder Tool Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder.Builder/README.md Install the TZFinder.Builder tool globally or locally to create custom time zone data files. ```batch dotnet new tool-manifest dotnet tool install TZFinder.Builder ``` -------------------------------- ### Install TZFinder NuGet Package Source: https://context7.com/devsko/tzfinder/llms.txt Use the dotnet CLI to add the TZFinder package to your project. ```bash dotnet add package TZFinder ``` -------------------------------- ### Installation Source: https://context7.com/devsko/tzfinder/llms.txt Install the TZFinder NuGet package to add time zone lookup capabilities to your .NET application. ```APIDOC ## Installation Install the TZFinder NuGet package to add time zone lookup capabilities to your .NET application. ```bash dotnet add package TZFinder ``` ``` -------------------------------- ### Install TZFinder Package Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder.Builder/README.md Use the dotnet CLI to add the TZFinder NuGet package to your project. ```batch dotnet package add TZFinder ``` -------------------------------- ### Install and Use TZFinder.Builder CLI Tool Source: https://context7.com/devsko/tzfinder/llms.txt Commands to install the `TZFinder.Builder` CLI tool and generate custom time zone data files with various options like resolution, ring distance, inclusion of Etc/GMT zones, specific releases, and overwriting existing files. ```bash # Install the tool dotnet new tool-manifest dotnet tool install TZFinder.Builder # Generate with default settings (maxLevel=25, minRingDistance=600) dotnet tz-build --output ./data # Generate high-resolution data file dotnet tz-build --output ./data --maxLevel 30 --minRingDistance 152 # Generate small data file dotnet tz-build --output ./data --maxLevel 20 --minRingDistance 5000 # Include Etc/GMT time zones (for ocean coverage) dotnet tz-build --output ./data --includeEtc # Use specific Timezone Boundary Builder release dotnet tz-build --output ./data --release 2024a # Overwrite existing file dotnet tz-build --output ./data --force ``` -------------------------------- ### Create Custom Data File with TZFinder.Builder Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder/README.md Install and run the `TZFinder.Builder` tool to create a custom time zone data file. This process can be computationally intensive. ```batch dotnet new tool-manifest dotnet tool install TZFinder.Builder dotnet tz-build ``` -------------------------------- ### Get Time Zone ID from Coordinates Source: https://context7.com/devsko/tzfinder/llms.txt Use TZLookup.GetTimeZoneId with longitude and latitude to find the IANA time zone identifier. Examples include Paris, New York, Tokyo, and Sydney. ```csharp using TZFinder; // Simple lookup - Paris, France string parisTimeZone = TZLookup.GetTimeZoneId(2.255419f, 47.479083f); Console.WriteLine(parisTimeZone); // Output: Europe/Paris // New York City string nyTimeZone = TZLookup.GetTimeZoneId(-74.006f, 40.7128f); Console.WriteLine(nyTimeZone); // Output: America/New_York // Tokyo, Japan string tokyoTimeZone = TZLookup.GetTimeZoneId(139.6917f, 35.6895f); Console.WriteLine(tokyoTimeZone); // Output: Asia/Tokyo // Sydney, Australia string sydneyTimeZone = TZLookup.GetTimeZoneId(151.2093f, -33.8688f); Console.WriteLine(sydneyTimeZone); // Output: Australia/Sydney ``` -------------------------------- ### Get Time Zone ID by Coordinates Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder.Builder/README.md Retrieve the IANA time zone ID for a specific latitude and longitude. Ensure the necessary data file is included in your project. ```csharp string id = TZFinder.TZLookup.GetTimeZoneId(2.255419f, 47.479083f); // Europe/Paris ``` -------------------------------- ### Get All Time Zone IDs for a Location Source: https://context7.com/devsko/tzfinder/llms.txt Retrieve all applicable IANA time zone identifiers for a given longitude and latitude using TZLookup.GetAllTimeZoneIds. This method is particularly useful for disputed territories that may fall under multiple time zones. ```csharp using TZFinder; // Get all time zones for a location (useful for disputed territories) IEnumerable allZones = TZLookup.GetAllTimeZoneIds( longitude: 34.8f, latitude: 31.5f, out BBox box, out TimeZoneIndex index); Console.WriteLine("Time Zones at this location:"); foreach (string zone in allZones) { Console.WriteLine($" - {zone}"); } Console.WriteLine($"Primary Index: {index.First}"); Console.WriteLine($"Secondary Index: {index.Second}"); ``` -------------------------------- ### Get Time Zone ID with Bounding Box Source: https://context7.com/devsko/tzfinder/llms.txt Retrieve the time zone identifier and its associated bounding box using TZLookup.GetTimeZoneId with an out parameter for BBox. Useful for caching or visualization. ```csharp using TZFinder; // Get time zone with bounding box information string timeZone = TZLookup.GetTimeZoneId(2.3522f, 48.8566f, out BBox box); Console.WriteLine($"Time Zone: {timeZone}"); Console.WriteLine($"Bounding Box:"); Console.WriteLine($" Southwest: Lon={box.SouthWest.Longitude}, Lat={box.SouthWest.Latitude}"); Console.WriteLine($" Northeast: Lon={box.NorthEast.Longitude}, Lat={box.NorthEast.Latitude}"); // Output: // Time Zone: Europe/Paris // Bounding Box: // Southwest: Lon=2.3486328, Lat=48.8549805 // Northeast: Lon=2.3596191, Lat=48.8659668 ``` -------------------------------- ### Get Time Zone Index Source: https://context7.com/devsko/tzfinder/llms.txt Obtain a TimeZoneIndex struct for coordinates using TZLookup.GetTimeZoneIndex. This is useful for numeric indices or handling disputed areas. The index can be converted back to a time zone ID. ```csharp using TZFinder; // Get numeric index for a location TimeZoneIndex index = TZLookup.GetTimeZoneIndex(2.3522f, 48.8566f); Console.WriteLine($"First Index: {index.First}"); Console.WriteLine($"Second Index: {index.Second}"); // 0 if no disputed area Console.WriteLine($"Is Empty: {index.IsEmpty}"); // Convert index back to time zone ID string timeZoneId = TZLookup.GetTimeZoneId(index.First); Console.WriteLine($"Time Zone: {timeZoneId}"); // Get index with bounding box TimeZoneIndex indexWithBox = TZLookup.GetTimeZoneIndex(2.3522f, 48.8566f, out BBox boundingBox); Console.WriteLine($"Box SW: {boundingBox.SouthWest}"); ``` -------------------------------- ### Configure Time Zone Data File in Project Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder.Builder/README.md Specify which included data file (Small, Medium, Large) to use by setting the TimeZoneData property in your .csproj file. Default is Medium. ```xml Large ``` -------------------------------- ### TZFinder Position and BBox Types Usage Source: https://context7.com/devsko/tzfinder/llms.txt Demonstrates the usage of `Position` and `BBox` types for geographic coordinates and bounding boxes. Shows how to create them, access properties, and use them with `TZLookup` and `BBox.Split`. ```csharp using TZFinder; // Position represents a geographic point Position paris = new Position(longitude: 2.3522f, latitude: 48.8566f); Console.WriteLine($"Paris: {paris}"); // Output: [Lon=2.3522 Lat=48.8566] // BBox represents a rectangular area BBox world = BBox.World; // Entire world: (-180,-90) to (180,90) Console.WriteLine($"World SW: {world.SouthWest}"); Console.WriteLine($"World NE: {world.NorthEast}"); // Get bounding box from lookup TZLookup.GetTimeZoneId(2.3522f, 48.8566f, out BBox parisBox); // Split bounding box (used internally by GeoHash algorithm) int level = 0; (BBox hi, BBox lo) = parisBox.Split(ref level); Console.WriteLine($"Split at level {level}:"); Console.WriteLine($" High: SW={hi.SouthWest}, NE={hi.NorthEast}"); Console.WriteLine($" Low: SW={lo.SouthWest}, NE={lo.NorthEast}"); ``` -------------------------------- ### Initialize TZFinder Data Stream in MAUI Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder.Builder/README.md For MAUI applications, use this C# code to open the TZFinder data file from the app package before initializing TZLookup. ```csharp TZFinder.TZLookup.TimeZoneDataStream = await FileSystem.OpenAppPackageFileAsync(TZFinder.TZLookup.DataFileName); ``` -------------------------------- ### Build Custom Time Zone Data File Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder.Builder/README.md Run the dotnet tz-build command to generate a custom time zone data file. Use parameters to control output path, resolution, and other options. ```batch dotnet tz-build ``` -------------------------------- ### Configure Custom Data File Integration Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder.Builder/README.md To use a custom data file, set TimeZoneData to None and include the file in your project using either Content or EmbeddedResource item groups. ```xml None ``` -------------------------------- ### Configure MSBuild for TZFinder Data Resolution Source: https://context7.com/devsko/tzfinder/llms.txt Set the data file resolution and inclusion method in your project's .csproj file. Choose between Small, Medium, or Large data files and specify how the file should be included (e.g., Content, EmbeddedResource). ```xml Medium Content ``` -------------------------------- ### Direct Access to TZFinder TimeZoneTree Source: https://context7.com/devsko/tzfinder/llms.txt Shows how to access the internal `TimeZoneTree` for advanced operations like checking node and time zone counts, performing direct lookups, retrieving IDs from an index, and traversing the entire tree. ```csharp using TZFinder; // Access the loaded time zone tree TimeZoneTree tree = TZLookup.TimeZoneTree; Console.WriteLine($"Node count: {tree.NodeCount}"); Console.WriteLine($"Time zone count: {tree.TimeZoneIds.Length}"); // Direct tree lookup (TimeZoneIndex index, BBox box, int level) = tree.Get(2.3522f, 48.8566f); Console.WriteLine($"Found at tree level: {level}"); Console.WriteLine($"Time Zone Index: {index.First}"); // Get IDs from index IEnumerable ids = tree.GetIds(index); foreach (string id in ids) { Console.WriteLine($" Time Zone: {id}"); } // Full tree traversal int leafCount = 0; tree.Traverse((idx, bbox) => { leafCount++; // Process each leaf node }); Console.WriteLine($"Total leaf nodes: {leafCount}"); ``` -------------------------------- ### Configure Custom Data File Usage in .csproj Source: https://context7.com/devsko/tzfinder/llms.txt Instructions for using a custom-generated TZFinder data file in your project. This involves disabling built-in data and including your custom file either as a content file or an embedded resource. ```xml None ``` -------------------------------- ### TZLookup.EnsureLoadedAsync Source: https://context7.com/devsko/tzfinder/llms.txt Asynchronously ensures the time zone data is loaded. Call this during application startup to avoid lazy-loading delays on the first lookup. ```APIDOC ## TZLookup.EnsureLoadedAsync ### Description Asynchronously ensures the time zone data is loaded. Call this during application startup to avoid lazy-loading delays on the first lookup. ### Method static Task EnsureLoadedAsync() ### Response #### Success Response (200) - **Task** - A Task that completes when the time zone data is loaded. ### Request Example ```csharp using TZFinder; public class Program { public static async Task Main(string[] args) { Task loadTask = TZLookup.EnsureLoadedAsync(); Console.WriteLine("Initializing application..."); await loadTask; Console.WriteLine("Time zone data loaded"); string tz = TZLookup.GetTimeZoneId(2.3522f, 48.8566f); Console.WriteLine($"Time zone: {tz}"); } } ``` ``` -------------------------------- ### Initialize TZFinder Data Stream on Android Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder.Builder/README.md On Android, access the TZFinder data file using this C# code snippet to open the stream from the assets before using TZLookup. ```csharp TZFinder.TZLookup.TimeZoneDataStream = Assets!.Open(TZFinder.TZLookup.DataFileName, Access.Streaming); ``` -------------------------------- ### Traverse Time Zone Bounding Boxes Source: https://context7.com/devsko/tzfinder/llms.txt Traverses all bounding boxes within a specific time zone, invoking a callback action for each box. This can be used for graphical display or analysis of time zone boundaries. ```csharp using TZFinder; using System.Collections.Generic; // Traverse all bounding boxes in a time zone by ID List boxes = new(); TZLookup.Traverse("Europe/Paris", box => { boxes.Add(box); }); Console.WriteLine($"Europe/Paris contains {boxes.Count} bounding boxes"); // Traverse by coordinates (finds the time zone first) int boxCount = 0; TZLookup.Traverse(2.3522f, 48.8566f, box => { boxCount++; // Process each bounding box for visualization // box.SouthWest and box.NorthEast define the rectangle }); Console.WriteLine($"Traversed {boxCount} boxes"); // Traverse by TimeZoneIndex for disputed areas TimeZoneIndex index = TZLookup.GetTimeZoneIndex(34.8f, 31.5f); TZLookup.Traverse(index, box => { Console.WriteLine($"Box: SW({box.SouthWest.Longitude}, {box.SouthWest.Latitude}) " + $ ``` -------------------------------- ### TZLookup.TimeZoneDataPath and TimeZoneDataStream Source: https://context7.com/devsko/tzfinder/llms.txt Configure the source of time zone data. Use `TimeZoneDataPath` for file-based loading or `TimeZoneDataStream` for stream-based loading (required for MAUI and Android platforms). Must be set before any lookup operations. ```APIDOC ## TZLookup.TimeZoneDataPath and TimeZoneDataStream ### Description Configure the source of time zone data. Use `TimeZoneDataPath` for file-based loading or `TimeZoneDataStream` for stream-based loading (required for MAUI and Android platforms). Must be set before any lookup operations. ### Properties static string TimeZoneDataPath { get; set; } static Stream TimeZoneDataStream { get; set; } ### Usage #### Option 1: Set custom file path ```csharp TZLookup.TimeZoneDataPath = "/path/to/custom/TZFinder.TimeZoneData.bin"; ``` #### Option 2: Set stream (for MAUI/Android) ```csharp // MAUI example: TZLookup.TimeZoneDataStream = await FileSystem.OpenAppPackageFileAsync(TZLookup.DataFileName); // Android example: TZLookup.TimeZoneDataStream = Assets.Open(TZLookup.DataFileName, Access.Streaming); ``` ### Example ```csharp // After setting either TimeZoneDataPath or TimeZoneDataStream string tz = TZLookup.GetTimeZoneId(139.6917f, 35.6895f); ``` ``` -------------------------------- ### Merge Template Updates into Repository Source: https://github.com/devsko/tzfinder/blob/main/CONTRIBUTING.md Use this PowerShell script to fetch the latest template changes and merge them into your current branch. Resolve any conflicts manually and then push the updated branch. ```powershell git fetch git checkout origin/main ./tools/MergeFrom-Template.ps1 # resolve any conflicts, then commit the merge commit. git push origin -u HEAD ``` -------------------------------- ### Blazor Component for Time Zone Lookup Source: https://context7.com/devsko/tzfinder/llms.txt A Blazor component demonstrating how to use `TZLookup.GetTimeZoneId` to find the time zone ID for given coordinates. Ensure `TZFinder` is referenced and the data file is correctly configured. ```csharp // Usage in Blazor component @page "/timezone" @using TZFinder

Time Zone Lookup

Paris Time Zone: @parisZone

@code { private string parisZone = ""; protected override void OnInitialized() { parisZone = TZLookup.GetTimeZoneId(2.3522f, 48.8566f); } } ``` -------------------------------- ### Configure Blazor WASM for TZFinder Source: https://github.com/devsko/tzfinder/blob/main/src/TZFinder.Builder/README.md Add this XML configuration to your Blazor WASM project to ensure TZFinder's data is included as an embedded resource. ```xml EmbeddedResource ``` -------------------------------- ### Configure Blazor WASM for Embedded TZFinder Data Source: https://context7.com/devsko/tzfinder/llms.txt Embed the TZFinder data file as a resource for Blazor WebAssembly applications by setting `EmbeddedResource` in your .csproj file. ```xml EmbeddedResource ``` -------------------------------- ### Convert Time Zone ID to Index and Vice Versa Source: https://context7.com/devsko/tzfinder/llms.txt Converts between time zone string identifiers and their numeric indices. Indices are 1-based and useful for efficient storage or comparison. ```csharp using TZFinder; // Convert time zone ID to numeric index short parisIndex = TZLookup.GetTimeZoneIndex("Europe/Paris"); Console.WriteLine($"Europe/Paris index: {parisIndex}"); // Convert numeric index back to time zone ID string timeZoneFromIndex = TZLookup.GetTimeZoneId(parisIndex); Console.WriteLine($"Index {parisIndex} = {timeZoneFromIndex}"); // Example: Store indices for efficient comparison short index1 = TZLookup.GetTimeZoneIndex("America/New_York"); short index2 = TZLookup.GetTimeZoneIndex("America/New_York"); bool sameZone = index1 == index2; // true ``` -------------------------------- ### Access All Available Time Zone IDs Source: https://context7.com/devsko/tzfinder/llms.txt Provides access to all available time zone identifiers in the loaded data file as a read-only collection. Use this to check for existence or iterate through all known zones. ```csharp using TZFinder; using System.Collections.ObjectModel; // Access all available time zone IDs ReadOnlyCollection allIds = TZLookup.TimeZoneIds; Console.WriteLine($"Total time zones: {allIds.Count}"); Console.WriteLine("First 10 time zones:"); foreach (string id in allIds.Take(10)) { Console.WriteLine($" {id}"); } // Check if a specific time zone exists bool hasEuropeParis = allIds.Contains("Europe/Paris"); Console.WriteLine($"Has Europe/Paris: {hasEuropeParis}"); ``` -------------------------------- ### Calculate Etc/GMT Time Zone ID from Longitude Source: https://context7.com/devsko/tzfinder/llms.txt Calculates the Etc/GMT time zone identifier for a given longitude. Note that Etc/GMT signs are inverted from standard UTC offsets. ```csharp using TZFinder; // Calculate Etc time zones from longitude Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(0f)); // Output: Etc/GMT Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(7.4f)); // Output: Etc/GMT Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(7.6f)); // Output: Etc/GMT-1 Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(-7.6f)); // Output: Etc/GMT+1 Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(179.9f)); // Output: Etc/GMT-12 Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(-179.9f)); // Output: Etc/GMT+12 // Note: Etc/GMT signs are inverted (Etc/GMT-1 = UTC+1) ``` -------------------------------- ### TZLookup.Traverse Source: https://context7.com/devsko/tzfinder/llms.txt Traverses all bounding boxes within a specific time zone, invoking a callback action for each box. Useful for graphical display or analysis of time zone boundaries. ```APIDOC ## TZLookup.Traverse ### Description Traverses all bounding boxes within a specific time zone, invoking a callback action for each box. Useful for graphical display or analysis of time zone boundaries. ### Methods static void Traverse(string timeZoneId, Action callback) static void Traverse(float longitude, float latitude, Action callback) static void Traverse(TimeZoneIndex index, Action callback) ### Parameters #### Traverse(string, Action) - **timeZoneId** (string) - Required - The time zone identifier to traverse. - **callback** (Action) - Required - The action to perform for each bounding box. #### Traverse(float, float, Action) - **longitude** (float) - Required - The longitude to search within. - **latitude** (float) - Required - The latitude to search within. - **callback** (Action) - Required - The action to perform for each bounding box. #### Traverse(TimeZoneIndex, Action) - **index** (TimeZoneIndex) - Required - The time zone index to traverse. - **callback** (Action) - Required - The action to perform for each bounding box. ### Request Example ```csharp using TZFinder; using System.Collections.Generic; // Traverse all bounding boxes in a time zone by ID List boxes = new(); TZLookup.Traverse("Europe/Paris", box => { boxes.Add(box); }); Console.WriteLine($"Europe/Paris contains {boxes.Count} bounding boxes"); // Traverse by coordinates (finds the time zone first) int boxCount = 0; TZLookup.Traverse(2.3522f, 48.8566f, box => { boxCount++; // Process each bounding box for visualization // box.SouthWest and box.NorthEast define the rectangle }); Console.WriteLine($"Traversed {boxCount} boxes"); // Traverse by TimeZoneIndex for disputed areas TimeZoneIndex index = TZLookup.GetTimeZoneIndex(34.8f, 31.5f); TZLookup.Traverse(index, box => { Console.WriteLine($"Box: SW({box.SouthWest.Longitude}, {box.SouthWest.Latitude}) " + $ ``` -------------------------------- ### TZLookup.GetAllTimeZoneIds Source: https://context7.com/devsko/tzfinder/llms.txt Retrieves all time zone identifiers for a location, including overlapping zones in disputed areas. Some geographic regions may be claimed by multiple time zones, and this method returns all applicable identifiers. ```APIDOC ## TZLookup.GetAllTimeZoneIds Retrieves all time zone identifiers for a location, including overlapping zones in disputed areas. Some geographic regions may be claimed by multiple time zones, and this method returns all applicable identifiers. ### Method GET ### Endpoint /api/timezone/all ### Parameters #### Query Parameters - **longitude** (float) - Required - The longitude coordinate. - **latitude** (float) - Required - The latitude coordinate. ### Request Example ```csharp using TZFinder; // Get all time zones for a location (useful for disputed territories) IEnumerable allZones = TZLookup.GetAllTimeZoneIds( longitude: 34.8f, latitude: 31.5f, out BBox box, out TimeZoneIndex index); Console.WriteLine("Time Zones at this location:"); foreach (string zone in allZones) { Console.WriteLine($" - {zone}"); } Console.WriteLine($"Primary Index: {index.First}"); Console.WriteLine($"Secondary Index: {index.Second}"); ``` ### Response #### Success Response (200) - **timeZoneIds** (string[]) - An array of IANA time zone identifiers for the given coordinates. - **boundingBox** (BBox) - The bounding box containing the coordinates. - **timeZoneIndex** (TimeZoneIndex) - The time zone index for the given coordinates. ``` -------------------------------- ### TZLookup.CalculateEtcTimeZoneId Source: https://context7.com/devsko/tzfinder/llms.txt Calculates the Etc/GMT time zone identifier for a given longitude. Note that Etc/GMT signs are inverted from standard UTC offsets. ```APIDOC ## TZLookup.CalculateEtcTimeZoneId ### Description Calculates the Etc/GMT time zone identifier for a given longitude. Useful for ocean locations or areas not covered by named time zones. Note that Etc/GMT signs are inverted from standard UTC offsets. ### Method static string CalculateEtcTimeZoneId(float longitude) ### Parameters #### Path Parameters - **longitude** (float) - Required - The longitude to calculate the Etc/GMT time zone for. ### Response #### Success Response (200) - **string** - The Etc/GMT time zone identifier. ### Request Example ```csharp using TZFinder; Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(0f)); // Output: Etc/GMT Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(7.4f)); // Output: Etc/GMT Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(7.6f)); // Output: Etc/GMT-1 Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(-7.6f)); // Output: Etc/GMT+1 Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(179.9f)); // Output: Etc/GMT-12 Console.WriteLine(TZLookup.CalculateEtcTimeZoneId(-179.9f)); // Output: Etc/GMT+12 ``` ### Notes - Etc/GMT signs are inverted (Etc/GMT-1 = UTC+1) ``` -------------------------------- ### TZLookup.GetTimeZoneIndex Source: https://context7.com/devsko/tzfinder/llms.txt Returns a `TimeZoneIndex` struct for the specified coordinates. This is useful when you need to work with numeric indices or handle disputed areas that may have multiple time zones. ```APIDOC ## TZLookup.GetTimeZoneIndex Returns a `TimeZoneIndex` struct for the specified coordinates. This is useful when you need to work with numeric indices or handle disputed areas that may have multiple time zones. ### Method GET ### Endpoint /api/timezone/index ### Parameters #### Query Parameters - **longitude** (float) - Required - The longitude coordinate. - **latitude** (float) - Required - The latitude coordinate. ### Request Example ```csharp using TZFinder; // Get numeric index for a location TimeZoneIndex index = TZLookup.GetTimeZoneIndex(2.3522f, 48.8566f); Console.WriteLine($"First Index: {index.First}"); Console.WriteLine($"Second Index: {index.Second}"); // 0 if no disputed area Console.WriteLine($"Is Empty: {index.IsEmpty}"); // Convert index back to time zone ID string timeZoneId = TZLookup.GetTimeZoneId(index.First); Console.WriteLine($"Time Zone: {timeZoneId}"); // Get index with bounding box TimeZoneIndex indexWithBox = TZLookup.GetTimeZoneIndex(2.3522f, 48.8566f, out BBox boundingBox); Console.WriteLine($"Box SW: {boundingBox.SouthWest}"); ``` ### Response #### Success Response (200) - **timeZoneIndex** (TimeZoneIndex) - The time zone index for the given coordinates. - **boundingBox** (BBox) - The bounding box containing the coordinates (optional, if requested). ``` -------------------------------- ### TZLookup.GetTimeZoneId with BBox Source: https://context7.com/devsko/tzfinder/llms.txt Retrieves the time zone identifier along with the bounding box that contains the specified coordinates. The bounding box provides geographic boundaries useful for caching or visualization purposes. ```APIDOC ## TZLookup.GetTimeZoneId with BBox Retrieves the time zone identifier along with the bounding box that contains the specified coordinates. The bounding box provides geographic boundaries useful for caching or visualization purposes. ### Method GET ### Endpoint /api/timezone/bbox ### Parameters #### Query Parameters - **longitude** (float) - Required - The longitude coordinate. - **latitude** (float) - Required - The latitude coordinate. ### Request Example ```csharp using TZFinder; // Get time zone with bounding box information string timeZone = TZLookup.GetTimeZoneId(2.3522f, 48.8566f, out BBox box); Console.WriteLine($"Time Zone: {timeZone}"); Console.WriteLine($"Bounding Box:"); Console.WriteLine($" Southwest: Lon={box.SouthWest.Longitude}, Lat={box.SouthWest.Latitude}"); Console.WriteLine($" Northeast: Lon={box.NorthEast.Longitude}, Lat={box.NorthEast.Latitude}"); // Output: // Time Zone: Europe/Paris // Bounding Box: // Southwest: Lon=2.3486328, Lat=48.8549805 // Northeast: Lon=2.3596191, Lat=48.8659668 ``` ### Response #### Success Response (200) - **timeZoneId** (string) - The IANA time zone identifier for the given coordinates. - **boundingBox** (BBox) - The bounding box containing the coordinates. ``` -------------------------------- ### TZLookup.GetTimeZoneId Source: https://context7.com/devsko/tzfinder/llms.txt The primary method for retrieving the IANA time zone identifier for a given geographic location. Takes longitude and latitude as float parameters and returns the time zone string (e.g., "Europe/Paris", "America/New_York"). ```APIDOC ## TZLookup.GetTimeZoneId The primary method for retrieving the IANA time zone identifier for a given geographic location. Takes longitude and latitude as float parameters and returns the time zone string (e.g., "Europe/Paris", "America/New_York"). ### Method GET ### Endpoint /api/timezone ### Parameters #### Query Parameters - **longitude** (float) - Required - The longitude coordinate. - **latitude** (float) - Required - The latitude coordinate. ### Request Example ```csharp using TZFinder; // Simple lookup - Paris, France string parisTimeZone = TZLookup.GetTimeZoneId(2.255419f, 47.479083f); Console.WriteLine(parisTimeZone); // Output: Europe/Paris // New York City string nyTimeZone = TZLookup.GetTimeZoneId(-74.006f, 40.7128f); Console.WriteLine(nyTimeZone); // Output: America/New_York // Tokyo, Japan string tokyoTimeZone = TZLookup.GetTimeZoneId(139.6917f, 35.6895f); Console.WriteLine(tokyoTimeZone); // Output: Asia/Tokyo // Sydney, Australia string sydneyTimeZone = TZLookup.GetTimeZoneId(151.2093f, -33.8688f); Console.WriteLine(sydneyTimeZone); // Output: Australia/Sydney ``` ### Response #### Success Response (200) - **timeZoneId** (string) - The IANA time zone identifier for the given coordinates. ``` -------------------------------- ### TZLookup.TimeZoneIds Source: https://context7.com/devsko/tzfinder/llms.txt Provides access to all available time zone identifiers in the loaded data file as a read-only collection. ```APIDOC ## TZLookup.TimeZoneIds ### Description Provides access to all available time zone identifiers in the loaded data file as a read-only collection. ### Method static ReadOnlyCollection TimeZoneIds { get; } ### Response #### Success Response (200) - **ReadOnlyCollection** - A read-only collection of all available time zone identifiers. ### Request Example ```csharp using TZFinder; using System.Collections.ObjectModel; ReadOnlyCollection allIds = TZLookup.TimeZoneIds; Console.WriteLine($"Total time zones: {allIds.Count}"); Console.WriteLine("First 10 time zones:"); foreach (string id in allIds.Take(10)) { Console.WriteLine($" {id}"); } bool hasEuropeParis = allIds.Contains("Europe/Paris"); Console.WriteLine($"Has Europe/Paris: {hasEuropeParis}"); ``` ``` -------------------------------- ### TZLookup.GetTimeZoneIndex and GetTimeZoneId Source: https://context7.com/devsko/tzfinder/llms.txt Convert between time zone string identifiers and their numeric indices. The indices are 1-based and can be used for efficient storage or comparison operations. ```APIDOC ## TZLookup.GetTimeZoneIndex and GetTimeZoneId ### Description Convert between time zone string identifiers and their numeric indices. The indices are 1-based and can be used for efficient storage or comparison operations. ### Methods static short GetTimeZoneIndex(string timeZoneId) static string GetTimeZoneId(short index) ### Parameters #### GetTimeZoneIndex - **timeZoneId** (string) - Required - The time zone identifier to convert to an index. #### GetTimeZoneId - **index** (short) - Required - The 1-based numeric index to convert to a time zone identifier. ### Response #### Success Response (200) - **GetTimeZoneIndex**: Returns a short representing the 1-based index of the time zone. - **GetTimeZoneId**: Returns a string representing the time zone identifier. ### Request Example ```csharp using TZFinder; short parisIndex = TZLookup.GetTimeZoneIndex("Europe/Paris"); Console.WriteLine($"Europe/Paris index: {parisIndex}"); string timeZoneFromIndex = TZLookup.GetTimeZoneId(parisIndex); Console.WriteLine($"Index {parisIndex} = {timeZoneFromIndex}"); short index1 = TZLookup.GetTimeZoneIndex("America/New_York"); short index2 = TZLookup.GetTimeZoneIndex("America/New_York"); bool sameZone = index1 == index2; // true ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.