UNPKG

hijri-ma

Version:

```sh npm install ```

39 lines (32 loc) 710 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatDate = void 0; const { getMonthName } = require('./hijri'); const config = require('./config'); const { wrapString } = require('./utils'); /** * * * @param {*} day * @param {*} month * @param {boolean} [inArabic=true] * @param {*} [year=config.YEAR] * @returns */ const formatDate = (day, month, inArabic = true, year = config.year) => { return inArabic ? [{ name: year }, { name: getMonthName(month), isRtl: true }, { name: day }].map(e => wrapString(e.name, e.isRtl)).join(' ').trim('') : `${day} ${getMonthName(month, false)} ${year}`; }; exports.formatDate = formatDate;