// Handle am/pm modifiers (e.g. "1 in the afternoon") and time of day (e.g. "mid-morning") public void AddDesc(TimeResult result, string dayDesc) { if (string.IsNullOrEmpty(dayDesc)) { return; } dayDesc = NormalizeDayDesc(dayDesc); if (result.Hour >= 0 && LowBoundDesc.ContainsKey(dayDesc) && (result.Hour < LowBoundDesc[dayDesc] || (result.Hour == Constants.HalfDayHourCount && LowBoundDesc[dayDesc] == Constants.DayHourStart))) { // cases like "1 in the afternoon", "12 midnight" result.Hour += Constants.HalfDayHourCount; result.LowBound = LowBoundDesc[dayDesc]; } else if (result.Hour < 0 && LowBoundDesc.ContainsKey(dayDesc)) { // cases like "mid-morning", "mid-afternoon" result.LowBound = LowBoundDesc[dayDesc]; result.Hour = result.LowBound; } else { result.LowBound = 0; } }
public void AddDesc(TimeResult result, string dayDesc) { if (string.IsNullOrEmpty(dayDesc)) { return; } dayDesc = NormalizeDayDesc(dayDesc); if (LowBoundDesc.ContainsKey(dayDesc) && result.Hour < LowBoundDesc[dayDesc]) { result.Hour += Constants.HalfDayHourCount; result.LowBound = LowBoundDesc[dayDesc]; } else { result.LowBound = 0; } }