Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.68 KB

README.md

File metadata and controls

55 lines (40 loc) · 1.68 KB

ZipTz4J

ZipTz4J is a Java library for mapping US zip codes to timezones. It is a port of the infused/ziptz Ruby library.

Quality Gate Status Vulnerabilities

Installation

Gradle (Kotlin)

dependencies {
    implementation("dev.surratt:ziptz4j:0.1.1")
}

Gradle (Groovy)

dependencies {
    compile 'dev.surratt:ziptz4j:0.1.1' 
}

Usage

import dev.surratt.ziptz4j;

final ZipCode zipCode = ZipCode.getZipCode("97034-1234");

System.out.println("Zipcode 97034-1234 is in timezone " + zipCode.getTimeZone());

The code above produces the following output:

Zipcode 97034-1234 is in timezone America/Los_Angeles

The zip code must be in one of the following formats:

  • 08402
  • 174068026
  • 98103-8634

A String of any other format will cause an IllegalArgumentException to be thrown.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT