import logging


def parse_time_window(timewindow):
    """
    Args:
        timewindow (str, optional): time window for plot. Must be in format: 'YYYY-MM-DD:YYYY-MM-DD'

    Returns:
        list:str containing starting and ending times
    """
    return_list = []
    try:
        parts = timewindow.split(":")
        for p in parts:
            date_parts = [int(i) for i in p.split('-')]
            return_list.append(date_parts)
    except:
        errmsg = 'error in calibplot.parse_time_window, while parsing timewindow. Timewindow must be in format yyyy-mm-dd:yyyy-mm-dd or ' + \
            'yyyy-mm-dd hhmm:yyyy-mm-dd hhmm. Ignoring timewindow'
        print(errmsg)
        logging.error(errmsg)
    return return_list