//
-// PersianCalendar.cs: Implements the Persian calendar
+// System.Globalization.PersianCalendar.cs
//
// Authors:
// Roozbeh Pournader (roozbeh@farsiweb.info)
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
namespace System.Globalization {
using System;
using System.IO;
+using System.Runtime.InteropServices;
/// <summary>
/// This is the Persian calendar of Iran, also known as the Iranian
/// on the mean tropical year, not the mean March equinoctial year.
/// </para>
/// </remarks>
+[Serializable]
public class PersianCalendar : Calendar {
/// <summary>
/// Constructor.
public PersianCalendar() {
M_AbbrEraNames = new string[] {"A.P."};
M_EraNames = new string[] {"Anno Persico"};
- if (M_TwoDigitYearMax == 99)
+ if (twoDigitYearMax == 99)
// FIXME: the .NET documentation does not mention the default value,
// This is the value mentioned in the .NET documentation example result.
- M_TwoDigitYearMax = 1410;
+ twoDigitYearMax = 1410;
}
/// <summary>
return new int[] { PersianEra };
}
}
-
- // FIXME: the .NET documentation does not mention the default value,
- // This is the value mentioned in the .NET documentation example result.
- int twoDigitYearMax = 1410;
public override int TwoDigitYearMax {
get {
return PersianEra;
}
+ public override int GetLeapMonth (int year, int era)
+ {
+ return 0;
+ }
+
/// <summary>
/// Overridden. Gives the number of the month of the specified
/// date.
/// </exception>
public override DateTime ToDateTime(int year, int month, int day,
int hour, int minute,
- int second, int milliseconds,
+ int second, int millisecond,
int era)
{
M_CheckYMDE(year, month, day, ref era);
- M_CheckHMSM(hour, minute, second, milliseconds);
+ M_CheckHMSM(hour, minute, second, millisecond);
int rd = fixed_from_dmy(day, month, year);
return CCFixed.ToDateTime(rd,
- hour, minute, second, milliseconds);
+ hour, minute, second, millisecond);
}
// FIXME: Calendar.cs and HebrewCalendar.cs are different in
return baseCentury + year - 100;
}
+ public override CalendarAlgorithmType AlgorithmType {
+ get {
+ return CalendarAlgorithmType.SolarCalendar;
+ }
+ }
+
+ static DateTime PersianMin = new DateTime (622, 3, 21, 0, 0, 0);
+ static DateTime PersianMax = new DateTime (9999, 12, 31, 11, 59, 59);
+
+ public override DateTime MinSupportedDateTime {
+ get {
+ return PersianMin;
+ }
+ }
+
+ public override DateTime MaxSupportedDateTime {
+ get {
+ return PersianMax;
+ }
+ }
} // class PersianCalendar
} // namespace System.Globalization
-
-#endif