Gravity.GoogleMaps.TimeZoneBuilder 2.0.0

dotnet add package Gravity.GoogleMaps.TimeZoneBuilder --version 2.0.0
                    
NuGet\Install-Package Gravity.GoogleMaps.TimeZoneBuilder -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Gravity.GoogleMaps.TimeZoneBuilder" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Gravity.GoogleMaps.TimeZoneBuilder" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Gravity.GoogleMaps.TimeZoneBuilder" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Gravity.GoogleMaps.TimeZoneBuilder --version 2.0.0
                    
#r "nuget: Gravity.GoogleMaps.TimeZoneBuilder, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Gravity.GoogleMaps.TimeZoneBuilder@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Gravity.GoogleMaps.TimeZoneBuilder&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Gravity.GoogleMaps.TimeZoneBuilder&version=2.0.0
                    
Install as a Cake Tool

🌐 Gravity.GoogleMaps.TimeZoneBuilder

Gravity.GoogleMaps.TimeZoneBuilder is a fully type-safe, fluent, and extensible .NET URL builder for the Google Time Zone API. It helps you generate correct and validated Time Zone API request URLs β€” with full IntelliSense, compile-time safety, and built-in validation for coordinates, timestamps, languages, and required parameters.


πŸš€ Features

  • βœ… Fully type-safe and fluent API
  • πŸ“ Strong validation for latitude/longitude bounds
  • ⏱️ Automatic handling of Unix timestamps from DateTimeOffset
  • 🌐 Optional language support with format validation
  • πŸ” API key validation (can be disabled for testing)
  • βš™οΈ Options to disable URL encoding or return only query parameters
  • πŸ§ͺ Fully unit-tested (100% coverage on builders)

πŸ“¦ Installation

dotnet add package Gravity.GoogleMaps.TimeZoneBuilder

πŸ“š Documentation

The builder supports all core parameters of the Time Zone API:

  • location β†’ latitude/longitude
  • timestamp β†’ DateTimeOffset, converted internally to Unix time
  • language (optional)
  • key β†’ required unless disabled in options

πŸ“Œ Refer to the official Google Time Zone API documentation for parameter semantics and output fields.


⚑ Quick Start

var url = new TimeZoneUrlBuilder()
    .AddLocation(48.8566, 2.3522)
    .AddTimeStamp(DateTimeOffset.UtcNow)
    .AddLanguage("fr")
    .AddKey("YOUR_API_KEY")
    .Build();

This will generate a fully validated Time Zone API request URL.


🧱 Fluent API

Every part of the URL is constructed through intuitive, discoverable methods:

.AddLocation(latitude: 40.6892, longitude: -74.0445)
.AddTimeStamp(DateTimeOffset.UtcNow)
.AddLanguage("en")
.AddKey("my-api-key")

βš™οΈ Advanced Options

The builder also supports configuration options through:

.WithOptions(new TimeZoneBuilderOptions
{
    DisableUrlEncoding = true,
    DisableApiKeyCheck = true,
    ReturnParametersOnly = false
});

Available options:

Option Description
DisableUrlEncoding Leaves commas and values unescaped (useful for debugging)
DisableApiKeyCheck Allows building URLs without .AddKey() (tests, mocks)
ReturnParametersOnly Returns only param=value… without the base host

πŸ§ͺ Test Coverage & Reliability

The builder is fully covered by unit tests:

  • βœ”οΈ Valid & invalid coordinates
  • βœ”οΈ Valid & invalid language codes
  • βœ”οΈ Timestamp conversion
  • βœ”οΈ Missing API key handling
  • βœ”οΈ Options overrides
  • βœ”οΈ URL encoding checks

Every scenario is validated both at build-time and runtime.


πŸ›‘οΈ License

MIT License


πŸ™Œ Credits

Made with ❀️ by GravityApps Developed & maintained by https://github.com/AntoninLolivier

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 687 12/3/2025
1.0.2 347 11/21/2025
1.0.1 344 11/21/2025
1.0.0 347 11/21/2025