import { DateTime } from 'luxon';
import { useCallback, useEffect, useState } from 'react';
import { useInterval } from '../../lib/ui/use-interval.js';
export function useIsDateInPast(date) {
    const [isDateInPast, setIsDateInPast] = useState(null);
    const update = useCallback(() => {
        if (date == null)
            return;
        setIsDateInPast(isInPast(DateTime.fromISO(date)));
    }, [date]);
    useEffect(update, [update]);
    useInterval(update);
    return isDateInPast;
}
const isInPast = (dt) => {
    if (!dt.isValid)
        return null;
    return dt.diffNow().milliseconds < 0;
};
//# sourceMappingURL=use-is-date-in-past.js.map