HebrewDateTime class
A midnight-based civil date and time in the fixed Hebrew calendar.
Supported years are 1..9999 (Anno Mundi). Month slots are stable: Tishri=1, Adar I=6 (leap years only), Adar/Adar II=7, Nisan=8, Elul=13. monthOrdinal is the chronological position in the current year. Absent Adar I is rejected; day/clock and out-of-slot month overflow normalize. Sunset-based observances are outside this civil API. Instances retain the native instant and UTC/local mode, like the other calendar date-time types.
- Inheritance
- Implemented types
- Available extensions
Constructors
- HebrewDateTime(int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0])
-
Creates a local Hebrew date, normalizing overflowing components in
the same style as DateTime.new.
factory
- HebrewDateTime.fromDateTime(DateTime dateTime)
-
Converts a native Gregorian
dateTimeto Hebrew without losing its instant, precision, or UTC/local representation.factory - HebrewDateTime.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch, {bool isUtc = false})
-
factory
- HebrewDateTime.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch, {bool isUtc = false})
-
factory
- HebrewDateTime.fromSecondsSinceEpoch(int secondsSinceEpoch, {bool isUtc = false})
-
factory
- HebrewDateTime.now()
-
The current local date and time in Hebrew.
factory
- HebrewDateTime.parse(String formattedString)
-
Parses a Hebrew ISO-8601-like string.
factory
- HebrewDateTime.timestamp()
-
The current UTC date and time in Hebrew.
factory
- HebrewDateTime.utc(int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0])
-
Creates a UTC Hebrew date, normalizing overflowing components in the
same style as DateTime.utc.
factory
Properties
- day → int
-
The day of the month
[1..31].final - dayOfYear → int
-
One-based day within the Hebrew year.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setteroverride
- hasOfficialCalendarData → bool
-
This fixed arithmetic calendar does not use published annual tables.
no setter
- hour → int
-
The hour of the day, expressed as in a 24-hour clock
[0..23].final - isLeapMonth → bool
-
no setter
- isLeapYear → bool
-
Whether this year contains the intercalary month Adar I.
no setteroverride
- isUtc → bool
-
True if this DateTime is set to UTC time.
finalinherited
- julianDay → int
-
Gregorian Julian day number for this calendar date.
no setteroverride
- microsecond → int
-
The microsecond
[0...999].final - microsecondsSinceEpoch → int
-
The number of microseconds since
the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setteroverride
- millisecond → int
-
The millisecond
[0...999].final - millisecondsSinceEpoch → int
-
The number of milliseconds since
the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setteroverride
- minute → int
-
The minute
[0...59].final - month → int
-
The month
[1..12].final - monthLength → int
-
Length of this Hebrew month.
no setteroverride
- monthOrdinal → int
-
no setter
- name → String
-
The calendar name.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- second → int
-
The second
[0...59].final - secondsSinceEpoch → int
-
Unix seconds, rounded down from the precise native instant.
no setteroverride
- timeZoneName → String
-
The time zone name.
no setteroverride
- timeZoneOffset → Duration
-
The time zone offset, which
is the difference between local time and UTC.
no setteroverride
- weekday → int
-
Weekday using DateTime.monday through DateTime.sunday.
no setteroverride
- year → int
-
The year.
final
- yearLength → int
-
Number of days in this Hebrew year.
no setter
Methods
-
add(
Duration duration) → HebrewDateTime -
Adds an exact duration and converts the resulting instant to Hebrew.
override
-
compareTo(
DateTime other) → int -
Compares this DateTime object to
other, returning zero if the values are equal.override -
copyWith(
{int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond, bool? isUtc}) → HebrewDateTime - Creates a copy with selected Hebrew wall-clock fields replaced.
-
copyWith(
{int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond, bool? isUtc}) → DateTime -
Available on DateTime, provided by the DateTimeCopyWith extension
Creates a new DateTime from this one by updating individual properties. -
difference(
DateTime other) → Duration -
Returns a Duration with the difference when subtracting
otherfrom this DateTime.override -
isAfter(
DateTime other) → bool -
Whether this DateTime occurs after
other.override -
isAtSameMomentAs(
DateTime other) → bool -
Whether this DateTime occurs at the same moment as
other.override -
isBefore(
DateTime other) → bool -
Whether this DateTime occurs before
other.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
subtract(
Duration duration) → HebrewDateTime -
Subtracts an exact duration and converts the resulting instant to
Hebrew.
override
-
toDateTime(
) → DateTime -
Converts this value to a native Gregorian DateTime.
override
-
toIso8601String(
) → String -
Returns an ISO-like string with Hebrew fields, not Gregorian.
override
-
toLocal(
) → HebrewDateTime -
Converts this instant to local time.
override
-
toString(
) → String -
Returns a human-readable string for this instance.
override
-
toUtc(
) → HebrewDateTime -
Converts this instant to UTC.
override
Operators
-
operator ==(
Object other) → bool -
Whether
otheris a DateTime at the same moment and in the same time zone (UTC or local).override
Static Properties
- maximumGregorianDate → DateTime
-
The last supported Gregorian calendar date, in UTC.
no setter
- minimumGregorianDate → DateTime
-
The first supported Gregorian calendar date, in UTC.
no setter
Static Methods
-
daysInMonth(
int year, int month) → int -
isSupportedDateTime(
DateTime dateTime) → bool -
Whether the Gregorian wall date of
dateTimeis within this implementation's supported range. -
isValidDate(
int year, int month, int day) → bool -
Whether
year,month, anddayform a strict (non-normalized) supported Hebrew date. -
monthIndex(
int year, int month) → int - Absolute chronological month coordinate for navigation and differences.
-
monthsInYear(
int year) → int -
monthsOfYear(
int year) → List< int> -
tryParse(
String formattedString) → HebrewDateTime? -
Parses
formattedString, returningnullfor invalid or unsupported dates.override
Constants
- adar → const int
- adarI → const int
- adarII → const int
- av → const int
- cheshvan → const int
- daysPerWeek → const int
- elul → const int
- friday → const int
- iyar → const int
- kislev → const int
- maximumMonthsPerYear → const int
- maximumYear → const int
- minimumYear → const int
- monday → const int
- nisan → const int
- saturday → const int
- shevat → const int
- sivan → const int
- sunday → const int
- tammuz → const int
- tevet → const int
- thursday → const int
- tishri → const int
- tuesday → const int
- wednesday → const int