internal static DyObject AddTo(ExecutionContext ctx, DyObject self, int years = 0, int months = 0, int days = 0) { var s = (DyDate)self.Clone(); try { if (days != 0) { s.AddDays(days); } if (months != 0) { s.AddMonths(months); } if (years != 0) { s.AddYears(years); } } catch (ArgumentOutOfRangeException) { return(ctx.Overflow()); } return(s); }
internal static DyObject AddTo(ExecutionContext ctx, DyObject self, int years = 0, int months = 0, int days = 0, double hours = 0, double minutes = 0, double seconds = 0, double milliseconds = 0, long ticks = 0) { var s = (DyDateTime)self.Clone(); try { if (ticks != 0) { s.AddTicks(ticks); } if (milliseconds != 0) { s.AddMilliseconds(milliseconds); } if (seconds != 0) { s.AddSeconds(seconds); } if (minutes != 0) { s.AddMinutes(minutes); } if (hours != 0) { s.AddHours(hours); } if (days != 0) { s.AddDays(days); } if (months != 0) { s.AddMonths(months); } if (years != 0) { s.AddYears(years); } } catch (ArgumentOutOfRangeException) { return(ctx.Overflow()); } return(s); }