Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AddYears()

override DateTime System.Globalization.EastAsianLunisolarCalendar.AddYears ( DateTime time,
int years )
inlineinherited

Definition at line 366 of file EastAsianLunisolarCalendar.cs.

367 {
368 CheckTicksRange(time.Ticks);
369 TimeToLunar(time, out var year, out var month, out var day);
370 year += years;
371 if (month == 13 && !InternalIsLeapYear(year))
372 {
373 month = 12;
374 day = InternalGetDaysInMonth(year, month);
375 }
376 int num = InternalGetDaysInMonth(year, month);
377 if (day > num)
378 {
379 day = num;
380 }
381 DateTime result = LunarToTime(time, year, month, day);
382 Calendar.CheckAddResult(result.Ticks, MinSupportedDateTime, MaxSupportedDateTime);
383 return result;
384 }
virtual DateTime MaxSupportedDateTime
Definition Calendar.cs:15
virtual DateTime MinSupportedDateTime
Definition Calendar.cs:13
DateTime LunarToTime(DateTime time, int year, int month, int day)
void TimeToLunar(DateTime time, out int year, out int month, out int day)

References System.Globalization.Calendar.CheckAddResult(), System.Globalization.EastAsianLunisolarCalendar.CheckTicksRange(), System.Globalization.EastAsianLunisolarCalendar.InternalGetDaysInMonth(), System.Globalization.EastAsianLunisolarCalendar.InternalIsLeapYear(), System.Globalization.EastAsianLunisolarCalendar.LunarToTime(), System.Globalization.Calendar.MaxSupportedDateTime, System.Globalization.Calendar.MinSupportedDateTime, System.DateTime.Ticks, System.Globalization.EastAsianLunisolarCalendar.TimeToLunar(), and System.year.