UNPKG

@progress/kendo-date-math

Version:

Kendo UI typescript package exporting functions for Date manipulations

22 lines (21 loc) 751 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.lastDayOfMonth = void 0; var add_days_1 = require("./add-days"); var create_date_1 = require("./create-date"); /** * A function which returns the last date of the month. * * @param date - The initial date. * @returns - The last date of the initial date month. * * @example * ```ts-no-run * lastDayOfMonth(new Date(2016, 0, 15)); // 2016-01-31 * ``` */ var lastDayOfMonth = function (date) { var newDate = (0, create_date_1.createDate)(date.getFullYear(), date.getMonth() + 1, 1, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()); return (0, add_days_1.addDays)(newDate, -1); }; exports.lastDayOfMonth = lastDayOfMonth;