/// <summary> /// a value representing a date that must occur on a given day (i.e. the third Thursday in November) /// </summary> public override void ExitCardinalDate([NotNull] MsdsParser.CardinalDateContext context) { var dayOfWeek = context.CARDINAL().GetText(); var weekday = context.WEEKDAY().GetText(); var month = context.MONTH().GetText(); var year = DateProvider.Today.Year; var date = DateCalculator.CardinalWeekday(dayOfWeek, weekday, month, year); _value.Put(context, date); var strDate = date.ToString(SqlDateFormat); _sql.Put(context, $"'{strDate}'"); }
/// <summary> /// A month and day of the current school year (i.e. July 1 through June 30) /// </summary> public override void ExitDayMonth([NotNull] MsdsParser.DayMonthContext context) { DateTime tmpDate; if (!DateTime.TryParse(context.DATE1().GetText(), out tmpDate)) { return; } var date = DateCalculator.SchoolYearDate((Month)tmpDate.Month, tmpDate.Day, DateProvider.Today); _value.Put(context, date); var strDate = date.ToString(SqlDateFormat); _sql.Put(context, $"'{strDate}'"); }