'use strict';

var React = require('react');

function FormatTime({ time: inputTime, use24HourClock, }) {
    let dateObject;
    if (inputTime instanceof Date) {
        dateObject = inputTime;
    }
    else {
        dateObject = new Date(inputTime);
    }
    return React.createElement(React.Fragment, null, dateToLocaleTimeString(dateObject, use24HourClock));
}
function dateToLocaleTimeString(date, use24HourClock) {
    const language = (globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) ? navigator.language : "en";
    return date.toLocaleTimeString(language, {
        hourCycle: use24HourClock ? "h23" : "h12",
        minute: "2-digit",
        hour: "numeric",
    });
}

exports.FormatTime = FormatTime;
