UNPKG

561 BJavaScriptView Raw
1"use strict";
2exports.yearsToMonths = yearsToMonths;
3var _index = require("./constants.js");
4
5/**
6 * @name yearsToMonths
7 * @category Conversion Helpers
8 * @summary Convert years to months.
9 *
10 * @description
11 * Convert a number of years to a full number of months.
12 *
13 * @param years - The number of years to be converted
14 *
15 * @returns The number of years converted in months
16 *
17 * @example
18 * // Convert 2 years into months
19 * const result = yearsToMonths(2)
20 * //=> 24
21 */
22function yearsToMonths(years) {
23 return Math.trunc(years * _index.monthsInYear);
24}