@progress/kendo-date-math
Version:
Kendo UI typescript package exporting functions for Date manipulations
20 lines (19 loc) • 810 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.durationInDecades = void 0;
var first_year_of_decade_1 = require("./first-year-of-decade");
/**
* A function that calculates duration in decades between two `Date` objects.
*
* @param start - The start date value.
* @param end - The end date value.
* @returns - The duration in months.
*
* @example
* ```ts-no-run
* durationInDecades(new Date(2016, 0, 1), new Date(2136, 0, 1)); // 12
* durationInDecades(new Date(2016, 0, 1), new Date(2016, 0, 1)); // 0
* ```
*/
var durationInDecades = function (start, end) { return (((0, first_year_of_decade_1.firstYearOfDecade)(end).getFullYear() - (0, first_year_of_decade_1.firstYearOfDecade)(start).getFullYear()) / 10); };
exports.durationInDecades = durationInDecades;