import _extends from "@babel/runtime/helpers/esm/extends";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import { useState } from 'react';
import { Time } from './utils';
import { useInterval } from './hooks';
export default function useTime() {
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
    format = _ref.format;
  var _useState = useState(Time.getSecondsFromTimeNow()),
    _useState2 = _slicedToArray(_useState, 2),
    seconds = _useState2[0],
    setSeconds = _useState2[1];
  useInterval(function () {
    setSeconds(Time.getSecondsFromTimeNow());
  }, 1000);
  return _extends({}, Time.getFormattedTimeFromSeconds(seconds, format));
}