Class

HebrewDate

HebrewDate(paramsopt)

Construct a new civil Hebrew date object. The constructor can be called with a params object that can contain the following properties:

  • julianday - the Julian Day to set into this date
  • year - any integer except 0. Years go from -1 (BCE) to 1 (CE), skipping the zero year
  • month - 1 to 12, where 1 means Nisan, 2 means Iyyar, etc.
  • day - 1 to 30
  • hour - 0 to 23. A formatter is used to display 12 hour clocks, but this representation is always done with an unambiguous 24 hour representation
  • parts - 0 to 1079. Specify the halaqim parts of an hour. Either specify the parts or specify the minutes, seconds, and milliseconds, but not both.
  • minute - 0 to 59
  • second - 0 to 59
  • millisecond - 0 to 999
  • locale - the TimeZone instance or time zone name as a string of this julian date. The date/time is kept in the local time. The time zone is used later if this date is formatted according to a different time zone and the difference has to be calculated, or when the date format has a time zone component in it.
  • timezone - the time zone of this instance. If the time zone is not given, it can be inferred from this locale. For locales that span multiple time zones, the one with the largest population is chosen as the one that represents the locale.
  • date - use the given intrinsic Javascript date to initialize this one.

If called with another Hebrew date argument, the date components of the given date are copied into the current one.

If the constructor is called with no arguments at all or if none of the properties listed above from julianday through millisecond are present, then the date components are filled in with the current date at the time of instantiation. Note that if you do not give the time zone when defaulting to the current time and the time zone for all of ilib was not set with ilib.setTimeZone(), then the time zone will default to UTC ("Universal Time, Coordinated" or "Greenwich Mean Time").

Constructor

# new HebrewDate(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

parameters that govern the settings and behaviour of this Hebrew date

View Source HebrewDate.js, line 79

Extends

Members

number

# day

The day of the month. This ranges from 1 to 30.

View Source HebrewDate.js, line 138

number

# dayOfYear

The day of the year. Ranges from 1 to 383.

View Source HebrewDate.js, line 182

number

# hour

The hour of the day. This can be a number from 0 to 23, as times are stored unambiguously in the 24-hour clock.

View Source HebrewDate.js, line 145

number

# millisecond

The millisecond of the second. Ranges from 0 to 999.

View Source HebrewDate.js, line 175

number

# minute

The minute of the hours. Ranges from 0 to 59.

View Source HebrewDate.js, line 163

number

# month

The month number, ranging from 1 to 13.

View Source HebrewDate.js, line 132

number

# parts

The parts (halaqim) of the hour. This can be a number from 0 to 1079.

View Source HebrewDate.js, line 152

number

# second

The second of the minute. Ranges from 0 to 59.

View Source HebrewDate.js, line 169

number

# year

Year in the Hebrew calendar.

View Source HebrewDate.js, line 126

Methods

# after(dow) → {IDate}

Return a new date instance in the current calendar that represents the first instance of the given day of the week after the current date. The day of the week is encoded as a number where 0 = Sunday, 1 = Monday, etc.

Parameters:
Name Type Description
dow number

the day of the week after the current date that is being sought

Inherited From:

View Source IDate.js, line 177

the date being sought

IDate

# before(dow) → {IDate}

Return a new date instance in the current calendar that represents the first instance of the given day of the week before the current date. The day of the week is encoded as a number where 0 = Sunday, 1 = Monday, etc.

Parameters:
Name Type Description
dow number

the day of the week before the current date that is being sought

Inherited From:

View Source IDate.js, line 162

the date being sought

IDate

# protected firstSunday()

Return the rd number of the first Sunday of the given ISO year.

Overrides:

View Source HebrewDate.js, line 450

the rd of the first Sunday of the ISO year

# getCalendar() → {string}

Return the name of the calendar that governs this date.

View Source HebrewDate.js, line 544

a string giving the name of the calendar

string

# getDayOfWeek() → {number}

Return the day of the week of this date. The day of the week is encoded as number from 0 to 6, with 0=Sunday, 1=Monday, etc., until 6=Saturday.

View Source HebrewDate.js, line 424

the day of the week

number

# getDayOfYear() → {number}

Return the ordinal day of the year. Days are counted from 1 and proceed linearly up to 385, regardless of months or weeks, etc. That is, Tishri 1st is day 1, and Elul 29 is 385 for a leap year with a long Heshvan and long Kislev.

View Source HebrewDate.js, line 474

the ordinal day of the year

number

# getEra() → {number}

Return the era for this date as a number. The value for the era for Hebrew calendars is -1 for "before the Hebrew era" and 1 for "the Hebrew era". Hebrew era dates are any date after Tishri 1, 1, which is the same as September 7, 3760 BC in the Gregorian calendar.

View Source HebrewDate.js, line 535

1 if this date is in the Hebrew era, -1 if it is before the Hebrew era

number

# getHalaqim() → {number}

Get the Halaqim (parts) of an hour. There are 1080 parts in an hour, which means each part is 3.33333333 seconds long. This means the number returned may not be an integer.

View Source HebrewDate.js, line 436

the halaqim parts of the current hour

number

# getJSDate() → {Date|undefined}

Return a Javascript Date object that is equivalent to this date object.

Inherited From:

View Source IDate.js, line 220

a javascript Date object

Date | undefined

# getJulianDay() → {number}

Return the Julian Day equivalent to this calendar date as a number.

Inherited From:

View Source IDate.js, line 253

the julian date equivalent of this date

number

# protected getRataDie() → {number}

Return the Rata Die (fixed day) number of this date.

Inherited From:

View Source IDate.js, line 231

the rd date as a number

number

# getTime() → {number}

Return the unix time equivalent to this date instance. Unix time is the number of milliseconds since midnight on Jan 1, 1970 UTC (Gregorian). This method only returns a valid number for dates between midnight, Jan 1, 1970 UTC (Gregorian) and Jan 19, 2038 at 3:14:07am UTC (Gregorian) when the unix time runs out. If this instance encodes a date outside of that range, this method will return -1. For date types that are not Gregorian, the point in time represented by this date object will only give a return value if it is in the correct range in the Gregorian calendar as given previously.

Inherited From:

View Source IDate.js, line 63

a number giving the unix time, or -1 if the date is outside the valid unix time range

number

# getTimeExtended() → {number}

Return the extended unix time equivalent to this Gregorian date instance. Unix time is the number of milliseconds since midnight on Jan 1, 1970 UTC. Traditionally unix time (or the type "time_t" in C/C++) is only encoded with an unsigned 32 bit integer, and thus runs out on Jan 19, 2038. However, most Javascript engines encode numbers well above 32 bits and the Date object allows you to encode up to 100 million days worth of time after Jan 1, 1970, and even more interestingly, 100 million days worth of time before Jan 1, 1970 as well. This method returns the number of milliseconds in that extended range. If this instance encodes a date outside of that range, this method will return NaN.

Inherited From:

View Source IDate.js, line 81

a number giving the extended unix time, or Nan if the date is outside the valid extended unix time range

number

# getTimeZone() → {string|undefined}

Return the time zone associated with this date, or undefined if none was specified in the constructor.

Inherited From:

View Source IDate.js, line 275

the name of the time zone for this date instance

string | undefined

# getWeekOfMonth(locale) → {number}

Return the ordinal number of the week within the month. The first week of a month is the first one that contains 4 or more days in that month. If any days precede this first week, they are marked as being in week 0. This function returns values from 0 through 6.

The locale is a required parameter because different locales that use the same Hebrew calendar consider different days of the week to be the beginning of the week. This can affect the week of the month in which some days are located.

Parameters:
Name Type Description
locale Locale | string

the locale or locale spec to use when figuring out the first day of the week

Overrides:

View Source HebrewDate.js, line 503

the ordinal number of the week within the current month

number

# getWeekOfYear() → {number}

Return the ISO 8601 week number in the current year for the current date. The week number ranges from 0 to 55, as some years have 55 weeks assigned to them in some calendars.

Inherited From:

View Source IDate.js, line 329

the week number for the current date

number

# onOrAfter(dow) → {IDate}

Return a new Gregorian date instance that represents the first instance of the given day of the week on or after the current date. The day of the week is encoded as a number where 0 = Sunday, 1 = Monday, etc.

Parameters:
Name Type Description
dow number

the day of the week on or after the current date that is being sought

Inherited From:

View Source IDate.js, line 207

the date being sought

IDate

# onOrBefore(dow) → {IDate}

Return a new Gregorian date instance that represents the first instance of the given day of the week on or before the current date. The day of the week is encoded as a number where 0 = Sunday, 1 = Monday, etc.

Parameters:
Name Type Description
dow number

the day of the week on or before the current date that is being sought

Inherited From:

View Source IDate.js, line 192

the date being sought

IDate

# setJulianDay(date)

Set the date of this instance using a Julian Day.

Parameters:
Name Type Description
date number | JulianDay

the Julian Day to use to set this date

Inherited From:

View Source IDate.js, line 261

# protected setRd(rd)

Set the date components of this instance based on the given rd.

Parameters:
Name Type Description
rd number

the rata die date to set

Inherited From:

View Source IDate.js, line 240

# setTime(millis)

Set the time of this instance according to the given unix time. Unix time is the number of milliseconds since midnight on Jan 1, 1970.

Parameters:
Name Type Description
millis number

the unix time to set this date to in milliseconds

Inherited From:

View Source IDate.js, line 91

# setTimeZone(tzNameopt)

Set the time zone associated with this date.

Parameters:
Name Type Attributes Description
tzName string <optional>

the name of the time zone to set into this date instance, or "undefined" to unset the time zone

Inherited From:

View Source IDate.js, line 284