ngx-bootstrap
Version:
Native Angular Bootstrap Components
36 lines • 1.36 kB
JavaScript
import { createDate } from '../../datepicker/utils/date-utils';
export function getDayOfWeek(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCDay() : date.getDay();
}
export function getDate(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCDate() : date.getDate();
}
export function getMonth(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCMonth() : date.getMonth();
}
export function getFullYear(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCFullYear() : date.getFullYear();
}
export function getFirstDayOfMonth(date) {
return createDate(date.getFullYear(), date.getMonth(), 1, date.getHours(), date.getMinutes(), date.getSeconds());
}
export function daysInMonth(date) {
return _daysInMonth(date.getFullYear(), date.getMonth());
}
export function _daysInMonth(year, month) {
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
}
export function isFirstDayOfWeek(date, firstDayOfWeek) {
return date.getDay() === firstDayOfWeek;
}
export function isSameMonth(date1, date2) {
if (!date1 || !date2) {
return false;
}
return getFullYear(date1) === getFullYear(date2) && getMonth(date1) === getMonth(date2);
}
//# sourceMappingURL=date-getters.js.map