import datetime
import datetime


def get_dates(start_date,end_date):
    """
    Creates a list of dates in string format 'Y-M-D'

    Yields
    ------
    list

    Note
    ------
    To change collection time frame, mend start_date and end_date
    """
    # the command argument is a string
    # convert the string dates to datetime object
    def ConvertDates(string_date):
        '''
        Convert string dates ("Y-M-D") to datetime object
        Parameters
        ----------
        string_date: a string
        Returns
        -------
        datetime object
        '''
        string_date = string_date.replace("-","")
        string_date = string_date.strip()
        date = datetime.datetime.strptime(string_date,"%Y%m%d").date()
        return date
    # create the date range
    date_range_list = []
    date_range = [ ConvertDates(start_date) + datetime.timedelta(n) for n in range(int ((ConvertDates(end_date) + datetime.timedelta(days=1) - ConvertDates(start_date)).days))]
    for date in date_range:
        date_range_list.append(str(date).replace("-","."))
    return(date_range_list)