package helper

import (
	"strings"
	"time"
)

func Dates(dr string) (start, finish time.Time, err error) {
	// split string in dates
	inicio := strings.Split(dr, "-")[0]
	final := strings.Split(dr, "-")[1]
	// remove spaces from strings
	inicio = strings.TrimSpace(inicio)
	final = strings.TrimSpace(final)
	// parse start date
	start, err = time.Parse("02/01/2006 15:04", inicio)
	if err != nil {
		return time.Time{}, time.Time{}, err
	}
	// parse finish date
	finish, err = time.Parse("02/01/2006 15:04", final)
	if err != nil {
		return time.Time{}, time.Time{}, err
	}
	return
}
