At the moment, when rendering the initial page view, timezon.es uses moment.js to get and display the user's current offset from UTC:
|
_getCityName: function() { |
|
return '<em>Browser local time</em> (UTC ' + this._ftz().moment().format('ZZ') + ')'; |
|
}, |
For all other cities added to the page, the IANA timezone from the tz database is displayed:
|
_getCityName: function() { |
|
var city = this.city(); |
|
if (undefined === city) { |
|
throw Error('This should not happen'); |
|
} |
|
if (city.hasOwnProperty('description')) { |
|
return '<em>' + city.name + ' - ' + city.description + '</em> (' + city.tz + ')'; |
|
} |
|
return '<em>' + city.name + '</em> (' + city.tz + ')'; |
|
}, |
The javascript Internationalization API now exposes the browser/OS's timezone through an API which could be used to give a more consistent experience (the offset could still be used if this was unavailable for any reason).
> Intl.DateTimeFormat().resolvedOptions().timeZone
'Europe/London'
At the moment, when rendering the initial page view, timezon.es uses
moment.jsto get and display the user's current offset from UTC:timezon.es/src/ftz.js
Lines 426 to 428 in 7e375b5
For all other cities added to the page, the IANA timezone from the tz database is displayed:
timezon.es/src/ftz.js
Lines 284 to 293 in 7e375b5
The javascript Internationalization API now exposes the browser/OS's timezone through an API which could be used to give a more consistent experience (the offset could still be used if this was unavailable for any reason).