new HeDate
new HeDate(milliseconds) // number of milliseconds since the epoch (1/1/1970)
new HeDate(year, month [, date [, hours [, minutes [, seconds [, milliseconds]]]]])NOTE:
UnlikeDate, HeDate can not parse a date string, and thus, it is not possible to construct with a string argument.
Constructing with a string will causeInvalid Date.
getFullYear: same as Date.getFullYear
getYear: same as Date.getYear
getMonth: same as Date.getMonth
getDate: same as Date.getDate
getUTCFullYear: same as Date.getUTCFullYear
getUTCMonthg: same as Date.getUTCMonth
getUTCDate: same as Date.getUTCDate
setFullYear: same as Date.setFullYear
setYear: same as Date.setYear
setMonth: same as Date.setMonth
setDate: same as Date.setDate
setUTCFullYear: same as Date.setUTCFullYear
setUTCMonth: same as Date.setUTCMonth
setUTCDate: same as Date.setUTCDate
toDateString:
This method is the same as
Date.toLocaleDateString
with the following form:
new Date().toLocaleDateString('en-US-u-ca-hebrew', {
month: 'long',
year: 'numeric',
day: '2-digit'
})toString:
Returns a string containing date and time information.
The time string is the same as Date.toTimeString
toUTCString: like toString with UTC context.
toGMTString: alias toUTCString.
NOTE:
The following methods were not touched, and return a gregorian date string:
toLocaleStringtoLocaleDateStringtoISOStringtoJSON
HeDate
Like the native Date object, calling HeDate() without a constructor returns a string representing the current hebrew date and time.
HeDate.UTC: same as Date.UTC
NOTE:
HeDate.nowis not supported, because there is no reason to do that.
HeDate.parsewas not yet written.
HeDate does not provide any function to detect weather a given year is leap or not.
if you want to ensure setting the month to the last Adar (Adar when normal year, or Adar II when leap year), you can do that by the following command:
date.setFullYear(nextYear, -7)This will calculate and set the date to 7 months before nextYear.
By the same way you can set the date to the last day of Heshvan or Kislev:
date.setMonth(3, 0)