internal IrDateRange(IrDate start, IrDate? end, int interval, bool isSplit, bool isHalfOpen) { Start = start; DatesHaveYear = start.Year != 0; if (end.HasValue) { IsRange = true; IsSplit = isSplit; IsHalfOpen = isHalfOpen; End = end.Value; } Interval = interval; HasInterval = interval != 0; }
internal IrDateRange(IrDate start, IrDate?end, int interval, bool isSplit, bool isHalfOpen) { Start = start; DatesHaveYear = start.Year != 0; if (end.HasValue) { IsRange = true; IsSplit = isSplit; IsHalfOpen = isHalfOpen; End = end.Value; } Interval = interval; HasInterval = interval != 0; }
private static void CompileDateArgument(IrGroup irGroup, ArgumentNode arg) { IrDate irStart; IrDate?irEnd = null; var isSplit = false; if (arg.IsWildcard) { irStart = new IrDate(null, 1, 1); irEnd = new IrDate(null, 12, 31); } else { var start = (DateValueNode)arg.Range.Start; irStart = new IrDate(start.Year, start.Month, start.Day); if (arg.Range.End != null) { var end = (DateValueNode)arg.Range.End; irEnd = new IrDate(end.Year, end.Month, end.Day); } else if (arg.HasInterval) { // if there is an interval, but no end value specified, then the end value is implied irEnd = new IrDate(null, 12, 31); } // check for split range (spans January 1) - not applicable for dates with explicit years if (irEnd.HasValue && !start.Year.HasValue) { if (irStart.Month >= irEnd.Value.Month && (irStart.Month > irEnd.Value.Month || irStart.Day > irEnd.Value.Day)) { isSplit = true; } } } var irArg = new IrDateRange(irStart, irEnd, arg.HasInterval ? arg.IntervalValue : 0, isSplit, arg.Range?.IsHalfOpen ?? false); (arg.IsExclusion ? irGroup.DatesExcluded : irGroup.Dates).Add(irArg); }
private static void CompileDateArgument(IrGroup irGroup, ArgumentNode arg) { IrDate irStart; IrDate? irEnd = null; var isSplit = false; if (arg.IsWildcard) { irStart = new IrDate(null, 1, 1); irEnd = new IrDate(null, 12, 31); } else { var start = (DateValueNode)arg.Range.Start; irStart = new IrDate(start.Year, start.Month, start.Day); if (arg.Range.End != null) { var end = (DateValueNode)arg.Range.End; irEnd = new IrDate(end.Year, end.Month, end.Day); } else if (arg.HasInterval) { // if there is an interval, but no end value specified, then the end value is implied irEnd = new IrDate(null, 12, 31); } // check for split range (spans January 1) - not applicable for dates with explicit years if (irEnd.HasValue && !start.Year.HasValue) { if (irStart.Month >= irEnd.Value.Month && (irStart.Month > irEnd.Value.Month || irStart.Day > irEnd.Value.Day)) { isSplit = true; } } } var irArg = new IrDateRange(irStart, irEnd, arg.HasInterval ? arg.IntervalValue : 0, isSplit, arg.Range?.IsHalfOpen ?? false); (arg.IsExclusion ? irGroup.DatesExcluded : irGroup.Dates).Add(irArg); }