// ParseTimeInfo parses out the time information from an input string in the format "MW9-11,F9".
ParseTimeInfo parses out the time information from an input string in the format "MW9-11,F9".
// ParseTimeInfo parses out the time information from an input string in the format " MW9 - 11 F9 " .
func ParseTimeInfo(timeInfoString string, termInfo TermInfo) (TimeInfo, error) {
	timeInfo := TimeInfo{
		Meetings: []ScheduledMeeting{},
		BeginsOn: termInfo.FirstDayOfClasses,
		EndsOn:   termInfo.LastDayOfClasses,
	}
	timeInfoString = strings.Replace(timeInfoString, "Thurs", "R", -1)
	timeInfoParts := strings.Split(timeInfoString, ",")
	for _, part := range timeInfoParts {
		meeting, beginsOn, endsOn, err := ParseScheduledMeeting(part, termInfo)
		if err != nil {
			return TimeInfo{}, err
		}
		if beginsOn != nil {
			timeInfo.BeginsOn = *beginsOn
		}
		if endsOn != nil {
			timeInfo.EndsOn = *endsOn
		}
		if meeting != nil {
			timeInfo.Meetings = append(timeInfo.Meetings, *meeting)
		}
	}
	return timeInfo, nil
}
func ParseTimeInfo ( timeInfoString string , termInfo TermInfo ) ( TimeInfo , error ) { timeInfo := TimeInfo { Meetings : [ ] ScheduledMeeting { } , BeginsOn : termInfo . FirstDayOfClasses , EndsOn : termInfo . LastDayOfClasses , } timeInfoString = strings . Replace ( timeInfoString , " " , " " , - 1 ) timeInfoParts := strings . Split ( timeInfoString , " " ) for _ , part := range timeInfoParts { meeting , beginsOn , endsOn , err := ParseScheduledMeeting ( part , termInfo ) if err != nil { return TimeInfo { } , err } if beginsOn != nil { timeInfo . BeginsOn = * beginsOn } if endsOn != nil { timeInfo . EndsOn = * endsOn } if meeting != nil { timeInfo . Meetings = append ( timeInfo . Meetings , * meeting ) } } return timeInfo , nil }
ParseTimeInfo parses out the time information from an input string in the format "MW9-11,F9".
ParseTimeInfo parses out the time information from an input string in the format " MW9 - 11 F9 " .
// hack to cope with the fact that some people really, really don't understand how the course catalog works // this is specifically for AS.301