import { useState, useEffect } from 'react';
import { parse } from 'date-fns';
var current = new Date();
var initTimeDate = new Date(current.getFullYear(), current.getMonth(), current.getDate());
export function useTimePanelValue(selected, defaultTime, format) {
    var value = selected || defaultTime;
    var _a = useState(value ? parse(value, format, initTimeDate) : initTimeDate), panelTime = _a[0], setPanelTime = _a[1];
    useEffect(function () {
        setPanelTime(value ? parse(value, format, initTimeDate) : initTimeDate);
    }, [value, defaultTime, format]);
    return { panelTime: panelTime, setPanelTime: setPanelTime };
}
