Time Zone Detection - fetus-hina/stat.ink GitHub Wiki

Time Zone Detection

Stat.ink estimates your time zone on your first access.
The estimation is done in the following order:

  1. (Restore time zone from cookie)

  2. Estimate the current location from your IP address.
    The system uses the GeoIP library/database to estimate your time zone from the location.

  3. Select the time zone according to the display language of the application.
    The display language of the application is obtained from the browser (and/or OS) settings.

Estimate from the IP address

By using the GeoIP library, we can estimate your approximate address from your IP address.
(Note: The address we can obtain here is up to the municipal level, and we will never know your actual location.)

For example, from IP address that assigned to author's home, we can get “Takatsuki, Osaka, Japan, Asia” (34.8586N 135.6061E, error: 500km/310mi) with “Asia/Tokyo” time zone. This is just enough accuracy to estimate the time zone, but it is about 10km/6mi away from the home.

If the time zone estimated by GeoIP is “our known time zone”, it will be used as it is. These include Asia/Tokyo, America/New_York, and Europe/Paris.

Check out the "our known time zone" on the this page: https://github.com/fetus-hina/stat.ink/wiki/Time-Zone-Support

Unfortunately, GeoIP returns more than just the time zones listed above.
So, if we don't have, we will guess what's “perhaps correct.”

For example, if GeoIP returns Europe/Berlin, we guess “Central European Time (Europe/Paris).”

If the system cannot find a substitutable time zone, the system may adopt an “offset from UTC” such as Etc/UTC-9.
In this format, 30 minutes offset can not be expressed. We will be required to add a new time zone.

Estimate from application language

The rule above should determine the time zone in almost all cases, but it is a mechanism provided just in case.

The system sets the following time zone according to the specified or detected language:

Language Time zone
Deutsch Europe/Paris
English (UK) Europe/London
English (US) America/Los_Angeles
Español (ES) Europe/Paris
Español (MX) America/Mexico_City
Français (FR) Europe/Paris
Français (CA) America/New_York
Italiano Europe/Paris
Nederlands Europe/Paris
Русский Europe/Moscow
日本語 Asia/Tokyo

This is a last resort.

Request for time zone addition

See this.