Choose between different timezone data products
masterAs of version 8, you can choose between three different data products based on your accuracy and file size requirements.
Important for TypeScript users: You may need to use the dist entry points for compatibility.
1. Alike Since 1970 (Default)
Uses unioned timezones that have been alike since 1970. It returns the identifier with the highest population among similar timekeeping methods.
- Use case: General purpose lookup where historical accuracy prior to 1970 is not required.
- Import:
require('geo-tz')orrequire('geo-tz/dist/find-1970')
2. Comprehensive
Contains all available timezone identifiers. This behaves like versions prior to v8, providing at least one unique identifier per country.
- Use case: When you need historical accuracy (including years prior to 1970).
- Tradeoff: Largest file size.
- Import:
require('geo-tz/all')orrequire('geo-tz/dist/find-all')
3. Same since now
Contains a unioned set of timezones that share the same timekeeping method into the future.
- Use case: When you only care about current and future timekeeping.
- Tradeoff: Smallest file size; may return identifiers based on current/future population trends.
- Import:
require('geo-tz/now')orrequire('geo-tz/dist/find-now')
// Comprehensive example
const { find } = require('geo-tz/all')
find(12.826174, 45.036933) // ['Asia/Aden']
// Same since now example
const { find } = require('geo-tz/now')
find(12.826174, 45.036933) // ['Europe/Moscow']