'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var api = require('./api.js');
var subscription = require('./subscription.js');
var errors = require('./errors.js');

/**
 * Returns the time zone of the checkout, and automatically re-renders
 * your component if the time zone changes.
 */
function useTimezone() {
  const api$1 = api.useApi();
  const extensionTarget = api$1.extension.target;
  if (!('timezone' in api$1.localization)) {
    throw new errors.ExtensionHasNoFieldError('timezone', extensionTarget);
  }
  return subscription.useSubscription(api$1.localization.timezone);
}

exports.useTimezone = useTimezone;
