import StateOptions from "../../../utils/state-options";
export function getStateAbbreviation(stateName) {
    const state = StateOptions.find(s => s.label === stateName);
    return state ? state.value : stateName;
}
// filterNumber is intended to be used to format a string that contains a single digit to a two digit string. 
export function filterNumber(num) {
    if (/^\d$/.test(num)) {
        return '0' + num;
    }
    return num;
}
export function constructDate(year, month, day) {
    if (!year || !month || !day) {
        return;
    }
    return `${year}-${filterNumber(month)}-${filterNumber(day)}`;
}
export function deconstructDate(formInput) {
    const dateString = formInput.value;
    const [dob_year, dob_month, dob_day] = dateString.split('-');
    return { dob_year, dob_month, dob_day };
}
export function checkProvisioningStatus(business) {
    return business.associated_accounts.length > 0;
}
