diff --git a/src/hdate.ts b/src/hdate.ts
index a066856..37d8939 100644
--- a/src/hdate.ts
+++ b/src/hdate.ts
@@ -19,6 +19,7 @@
along with this program. If not, see .
*/
import {
+ MonthName,
SimpleHebrewDate,
abs2hebrew,
daysInMonth,
@@ -324,7 +325,7 @@ export class HDate {
* const hd = new HDate(new Date(2008, 10, 13)); // 15 Cheshvan 5769
* hd.getMonthName(); // 'Cheshvan'
*/
- getMonthName(): string {
+ getMonthName(): MonthName {
return getMonthName(this.getMonth(), this.getFullYear());
}
@@ -610,7 +611,7 @@ export class HDate {
* import {HDate, months} from '@hebcal/hdate';
* HDate.getMonthName(months.CHESHVAN, 5769); // 'Cheshvan'
*/
- static getMonthName(month: number, year: number): string {
+ static getMonthName(month: number, year: number): MonthName {
return getMonthName(month, year);
}
diff --git a/src/hdateBase.ts b/src/hdateBase.ts
index c2f094b..bbfb2db 100644
--- a/src/hdateBase.ts
+++ b/src/hdateBase.ts
@@ -50,7 +50,7 @@ export const months = {
ADAR_II,
} as const;
-const monthNames0: string[] = [
+const monthNames0 = [
'',
'Nisan',
'Iyyar',
@@ -70,11 +70,14 @@ const monthNames0: string[] = [
* Regular years are index 0 and leap years are index 1.
* @private
*/
-const monthNames: string[][] = [
- monthNames0.concat(['Adar', 'Nisan']),
- monthNames0.concat(['Adar I', 'Adar II', 'Nisan']),
+const monthNames = [
+ [...monthNames0, 'Adar', 'Nisan'],
+ [...monthNames0, 'Adar I', 'Adar II', 'Nisan'],
] as const;
+/** Transliterated Hebrew month names. */
+export type MonthName = (typeof monthNames)[number][number];
+
const edCache: Map = new Map();
const EPOCH = -1373428;
@@ -227,7 +230,7 @@ export function daysInMonth(month: number, year: number): number {
* @param month Hebrew month (e.g. months.TISHREI)
* @param year Hebrew year
*/
-export function getMonthName(month: number, year: number): string {
+export function getMonthName(month: number, year: number): MonthName {
assertNumber(month, 'month');
assertNumber(year, 'year');
if (month < 1 || month > 14) {