UNPKG

563 BJavaScriptView Raw
1import { daysInWeek } from "./constants.js";
2
3/**
4 * @name weeksToDays
5 * @category Conversion Helpers
6 * @summary Convert weeks to days.
7 *
8 * @description
9 * Convert a number of weeks to a full number of days.
10 *
11 * @param weeks - The number of weeks to be converted
12 *
13 * @returns The number of weeks converted in days
14 *
15 * @example
16 * // Convert 2 weeks into days
17 * const result = weeksToDays(2)
18 * //=> 14
19 */
20export function weeksToDays(weeks) {
21 return Math.trunc(weeks * daysInWeek);
22}
23
24// Fallback for modularized imports:
25export default weeksToDays;