22
33internal class CalendarConstants
44{
5- /// <summary>
6- /// The year of the start of the Common Era (Start of migration of Islam prophet), which is 622.
7- /// </summary>
8- internal const int CommonEra = 622 ;
9-
105 /// <summary>
116 /// The Julian Day number of the start of the Gregorian calendar, which is October 15, 1582.
127 /// </summary>
@@ -18,14 +13,9 @@ internal class CalendarConstants
1813 internal const double PersianEpoch = 1948320.5 ;
1914
2015 /// <summary>
21- /// The Julian Day number of the start of the Persian year 475, which is March 20, 1096.
22- /// </summary>
23- internal const double BasePersianEpoch = 2121445.5 ;
24-
25- /// <summary>
26- /// Base year reference for the Persian calendar.
16+ /// Pivot value for the Gregorian reform adjustment (used in alpha calculation).
2717 /// </summary>
28- internal const int BasePersianYear = 475 ;
18+ internal const double GregorianReformPivot = 1867216.25 ;
2919
3020 /// <summary>
3121 /// The Julian Day number of the start of the Islamic calendar, which is July 16, 622.
@@ -40,7 +30,7 @@ internal class CalendarConstants
4030 /// <summary>
4131 /// The number of days in a non-leap year.
4232 /// </summary>
43- internal const double DaysInYear = 365 ;
33+ internal const int DaysInYear = 365 ;
4434
4535 /// <summary>
4636 /// The number of years in the Gregorian calendar's leap year cycle.
@@ -67,11 +57,6 @@ internal class CalendarConstants
6757 /// </summary>
6858 internal const double Century = 100 ;
6959
70- /// <summary>
71- /// The number of days in a Persian calendar cycle.
72- /// </summary>
73- internal const double CycleDays = 1029983 ;
74-
7560 /// <summary>
7661 /// The number of days at the end of a Persian calendar cycle.
7762 /// </summary>
@@ -102,20 +87,10 @@ internal class CalendarConstants
10287 /// </summary>
10388 internal const double CycleFactor = 1028522 ;
10489
105- /// <summary>
106- /// An adjustment made to the epoch in Persian calendar calculations.
107- /// </summary>
108- internal const double EpochAdjustment = 474 ;
109-
11090 /// <summary>
11191 /// The number of days in the first half of a Persian year.
11292 /// </summary>
113- internal const double DaysInHalfYear = 186 ;
114-
115- /// <summary>
116- /// The year before the epoch in the Persian calendar.
117- /// </summary>
118- internal const int YearBeforeEpoch = 474 ;
93+ internal const int DaysInHalfYear = 186 ;
11994
12095 /// <summary>
12196 /// The number of months in the first half of a Persian year.
@@ -127,26 +102,11 @@ internal class CalendarConstants
127102 /// </summary>
128103 internal const int DaysInFirstHalfMonth = 31 ;
129104
130- /// <summary>
131- /// A factor used in Persian calendar leap year calculations.
132- /// </summary>
133- internal const int LeapYearFactor = 682 ;
134-
135- /// <summary>
136- /// A value subtracted in Persian calendar leap year calculations.
137- /// </summary>
138- internal const int LeapYearSubtractor = 110 ;
139-
140105 /// <summary>
141106 /// The number of days in the second half of a Persian month.
142107 /// </summary>
143108 internal const int DaysInSecondHalfMonth = 30 ;
144109
145- /// <summary>
146- /// The difference in days between the first half and second half of a Persian month.
147- /// </summary>
148- internal const int FirstHalfToSecondHalfDayDifference = 6 ;
149-
150110 /// <summary>
151111 /// Represents the offset used to adjust the Julian day number to start from the middle of the day.
152112 /// </summary>
@@ -198,37 +158,37 @@ internal class CalendarConstants
198158 internal const int IslamicLeapYearMultiplier = 11 ;
199159
200160 /// <summary>
201- /// The total number of days in a 400-year cycle of the Gregorian calendar .
161+ /// Average number of days in a Gregorian “century” (100 × 365.2425) .
202162 /// </summary>
203- internal const int DaysIn400Years = 146097 ;
163+ internal const double DaysPerGregorianCentury = 36524.25 ;
204164
205165 /// <summary>
206- /// The total number of days in a century (100 years) of the Gregorian calendar .
166+ /// Offset to align the intermediate count so that March = month 1 in the algorithm .
207167 /// </summary>
208- internal const int DaysInCentury = 36524 ;
168+ internal const int JulianConversionBaseOffset = 1524 ;
209169
210170 /// <summary>
211- /// The total number of days in a 4- year cycle of the Gregorian calendar, including one leap year .
171+ /// Companion offset for extracting the year from the day count .
212172 /// </summary>
213- internal const int DaysIn4YearCycle = 1461 ;
173+ internal const double JulianYearOffset = 122.1 ;
214174
215175 /// <summary>
216- /// The offset used in the calculation of the month from a Julian day number .
176+ /// Average length of a Julian year, used when breaking out the year from days .
217177 /// </summary>
218- internal const int MonthCalculationOffset = 373 ;
178+ internal const double JulianYearDays = 365.25 ;
219179
220180 /// <summary>
221- /// The length of a complete grand cycle in the Persian calendar, consisting of 2820 years .
181+ /// Factor for converting the remaining days into a month index .
222182 /// </summary>
223- internal const int PersianCalendarGrandCycle = 2820 ;
183+ internal const double MonthExtractionFactor = 30.6001 ;
224184
225185 /// <summary>
226- /// The number of years in the smaller cycles within the 2820-year grand cycle of the Persian calendar .
186+ /// Year offset for dates in March–December when computing the final year .
227187 /// </summary>
228- internal const int YearsInSmallCycle = 120 ;
188+ internal const int YearOffsetAfterFebruary = 4716 ;
229189
230190 /// <summary>
231- /// The index of the last year in the smaller 120-year cycle of the Persian calendar .
191+ /// Year offset for dates in January–February when computing the final year .
232192 /// </summary>
233- internal const int LastYearInSmallCycleIndex = 119 ;
193+ internal const int YearOffsetBeforeMarch = 4715 ;
234194}
0 commit comments