ngx-bootstrap
Version:
Native Angular Bootstrap Components
75 lines • 2.53 kB
JavaScript
import { createDate } from '../create/date-from-array';
export function getHours(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCHours() : date.getHours();
}
export function getMinutes(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCMinutes() : date.getMinutes();
}
export function getSeconds(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCSeconds() : date.getSeconds();
}
export function getMilliseconds(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCMilliseconds() : date.getMilliseconds();
}
export function getTime(date) {
return date.getTime();
}
export function getDay(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 getUnixTime(date) {
return Math.floor(date.valueOf() / 1000);
}
export function unix(date) {
return Math.floor(date.valueOf() / 1000);
}
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 isSameYear(date1, date2) && getMonth(date1) === getMonth(date2);
}
export function isSameYear(date1, date2) {
if (!date1 || !date2) {
return false;
}
return getFullYear(date1) === getFullYear(date2);
}
export function isSameDay(date1, date2) {
if (!date1 || !date2) {
return false;
}
return (isSameYear(date1, date2) &&
isSameMonth(date1, date2) &&
getDate(date1) === getDate(date2));
}
//# sourceMappingURL=date-getters.js.map