// isLineInRange parses the date on the string and checks if it is in the range to check
isLineInRange parses the date on the string and checks if it is in the range to check
// isLineInRange parses the date on the string and checks if it is in the range to check
func (w Watch) isLineInRange(line string) (inRange bool) {
	found := false
	for _, r := range w.Regexs {
		dateStrSlice := r.FindAllString(line, -1)
		if len(dateStrSlice) == 0 {
			continue
		}
		found = true
		date, err := time.Parse("Jan 2 15:04:05", dateStrSlice[0])
		date = date.AddDate(time.Now().Year(), 0, 0) 
		if err != nil {
			log.Error("Error Parsing string to time in file: ", dateStrSlice[0])
		}
		end := time.Now()
		start := time.Now().AddDate(-w.Year, -w.Month, -w.Day)
		if inTimeRange(start, end, date) {
			return true
		}
	}
	if !found {
		log.Error("Unable to parse line to any regular expression")
	}
	return false
}
func ( w Watch ) isLineInRange ( line string ) ( inRange bool ) { found := false for _ , r := range w . Regexs { dateStrSlice := r . FindAllString ( line , - 1 ) if len ( dateStrSlice ) == 0 { continue } found = true date , err := time . Parse ( " " , dateStrSlice [ 0 ] ) date = date . AddDate ( time . Now ( ) . Year ( ) , 0 , 0 ) if err != nil { log . Error ( " " , dateStrSlice [ 0 ] ) } end := time . Now ( ) start := time . Now ( ) . AddDate ( - w . Year , - w . Month , - w . Day ) if inTimeRange ( start , end , date ) { return true } } if ! found { log . Error ( " " ) } return false }
isLineInRange parses the date on the string and checks if it is in the range to check
isLineInRange parses the date on the string and checks if it is in the range to check
//Note this will break on new years every year