Skip to content

Commit 61e7775

Browse files
committed
Add more documentation about HDate.greg()
1 parent 5c9ede6 commit 61e7775

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/greg.ts

+11
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,18 @@ export function greg2abs(date: Date): number {
112112
* Three Historical Calendars'' by E. M. Reingold, N. Dershowitz, and S. M.
113113
* Clamen, Software--Practice and Experience, Volume 23, Number 4
114114
* (April, 1993), pages 383-404 for an explanation.
115+
*
116+
* Note that this function returns the daytime portion of the date.
117+
* For example, the 15th of Cheshvan 5769 began at sundown on
118+
* 12 November 2008 and continues through 13 November 2008. This
119+
* function would return only the date 13 November 2008.
115120
* @param abs - R.D. number of days
121+
* @example
122+
* const hd = new HDate(15, 'Cheshvan', 5769);
123+
* const date = hd.greg(); // 13 November 2008
124+
* const year = date.getFullYear(); // 2008
125+
* const monthNum = date.getMonth() + 1; // 11
126+
* const day = date.getDate(); // 13
116127
*/
117128
export function abs2greg(abs: number): Date {
118129
if (typeof abs !== 'number') {

src/hdate.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,20 @@ export class HDate {
242242

243243
/**
244244
* Converts this Hebrew date to the corresponding Gregorian date.
245+
*
246+
* The returned `Date` object will be in the local (i.e. host system) time zone.
247+
* Hours, minutes, seconds and milliseconds will all be zero.
248+
*
245249
* Note that this function returns the daytime portion of the date.
246250
* For example, the 15th of Cheshvan 5769 began at sundown on
247251
* 12 November 2008 and continues through 13 November 2008. This
248252
* function would return only the date 13 November 2008.
249253
* @example
250254
* const hd = new HDate(15, 'Cheshvan', 5769);
251-
* hd.greg(); // 13 November 2008
255+
* const date = hd.greg(); // 13 November 2008
256+
* const year = date.getFullYear(); // 2008
257+
* const monthNum = date.getMonth() + 1; // 11
258+
* const day = date.getDate(); // 13
252259
*/
253260
greg(): Date {
254261
return abs2greg(this.abs());

0 commit comments

Comments
 (0)