UNPKG

hijri-ma

Version:

```sh npm install ```

63 lines (52 loc) 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCurrentMonth = exports.getCurrentDate = void 0; const { getData } = require('./extract'); const { formatDate } = require('./format'); const { generateMonth } = require('./generate'); const { getMonthNumber } = require('./hijri'); /** * * * @param {boolean} [inArabic=true] * @returns */ const getCurrentDate = async (inArabic = true) => { const { today, month } = await getData(); const monthIndex = getMonthNumber(month); return formatDate(today, monthIndex, inArabic); }; /** * * * @returns */ exports.getCurrentDate = getCurrentDate; const getCurrentMonth = async options => { const { today, month, expected } = await getData(); const result = generateMonth(today, month, expected, options).map(e => ({ day: e.day, year: e.year, month: getMonthNumber(e.month.ar), gregorianDate: e.gregorianDate })); return result; }; exports.getCurrentMonth = getCurrentMonth;