export default function parseTimeString(str) {
    const regexRes = new RegExp('[0-9]{0,2}:[0-9]{0,2}').exec(str);
    let hours = null;
    let minutes = null;
    if (regexRes) {
        const parts = regexRes[0].split(':');

        hours = parseInt(parts[0], 10) || 0;
        minutes = parseInt(parts[1], 10) || 0;
    }

    return {
        hours,
        minutes,
    };
}

const TIME_STRING_REGEX = /([0-9]{0,2}):([0-9]{0,2})/;

export default function parseTimeString(str) {
    const regexRes = TIME_STRING_REGEX.exec(str);
    let hours = null;
    let minutes = null;

    if (regexRes) {
        hours = parseInt(regexRes[1], 10) || 0;
        minutes = parseInt(regexRes[2], 10) || 0;
    }

    return {
        hours,
        minutes,
    };
}

Use regex for parsing TimeString
:recycle: Use regex for parsing TimeString
