import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { CardHeaderContainer, CardHeaderText } from './style';
import { useTranslation } from 'react-i18next';
import en from 'dayjs/locale/en';
import pl from 'dayjs/locale/pl';
import cs from 'dayjs/locale/cs';
// packages
import dayjs from 'dayjs';
// import 'dayjs/locale/en-ca';
const CardHeader = (props) => {
    const arrayOfAvailableLang = [pl.name, en.name, cs.name];
    const { t } = useTranslation();
    const { due, orderType, verifiedTime } = props;
    const setLang = arrayOfAvailableLang.find((l) => l === window.GLOBAL_3E_ORDERING_APP.config.lang);
    dayjs.locale(setLang);
    let minTime = dayjs(verifiedTime);
    if (due) {
        minTime = dayjs(due);
    }
    let lateOrderDate = '';
    if (dayjs(verifiedTime).date() - dayjs().date() < 0) {
        lateOrderDate = dayjs(verifiedTime).format('DD MMMM YYYY');
    }
    return (_jsx(CardHeaderContainer, { children: _jsxs(CardHeaderText, { children: [orderType === 'DELIVERY'
                    ? `${t('OS.KDS.Card.DeliveryType.Delivery')}: `
                    : `${t('OS.KDS.Card.DeliveryType.TakeAway')}: `, minTime.format('HH:mm dddd'), " ", _jsx("br", {}), " ", lateOrderDate] }) }));
};
export default CardHeader;
//# sourceMappingURL=index.js.map