get npm build to somehow work
This commit is contained in:
parent
d51d3f60f1
commit
b2056d4e2b
18 changed files with 3174 additions and 320 deletions
|
|
@ -288,6 +288,115 @@ export function getDate(date, utc) {
|
|||
return utc ? date.getUTCDate() : date.getDate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get day (alias for getDayOfWeek)
|
||||
*/
|
||||
export function getDay(date, utc) {
|
||||
return getDayOfWeek(date, utc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ISO day (Monday=1, Sunday=7)
|
||||
*/
|
||||
export function getISODay(date, utc) {
|
||||
const day = getDayOfWeek(date, utc);
|
||||
return day === 0 ? 7 : day;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get day of the year (alias for getDayOfYear)
|
||||
*/
|
||||
export function getDayOfTheYear(date, utc) {
|
||||
return getDayOfYear(date, utc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get first day of the year
|
||||
*/
|
||||
export function getFirstDayOfTheYear(date, utc) {
|
||||
date = makeDate(date);
|
||||
const year = getFullYear(date, utc);
|
||||
return new Date(Date.UTC(year, 0, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set date (day of month)
|
||||
*/
|
||||
export function setDate(date, day, utc) {
|
||||
date = makeDate(date);
|
||||
if (utc) {
|
||||
date.setUTCDate(day);
|
||||
} else {
|
||||
date.setDate(day);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set full year
|
||||
*/
|
||||
export function setFullYear(date, year, utc) {
|
||||
date = makeDate(date);
|
||||
if (utc) {
|
||||
date.setUTCFullYear(year);
|
||||
} else {
|
||||
date.setFullYear(year);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set month
|
||||
*/
|
||||
export function setMonth(date, month, utc) {
|
||||
date = makeDate(date);
|
||||
if (utc) {
|
||||
date.setUTCMonth(month);
|
||||
} else {
|
||||
date.setMonth(month);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set hours
|
||||
*/
|
||||
export function setHours(date, hours, utc) {
|
||||
date = makeDate(date);
|
||||
if (utc) {
|
||||
date.setUTCHours(hours);
|
||||
} else {
|
||||
date.setHours(hours);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set minutes
|
||||
*/
|
||||
export function setMinutes(date, minutes, utc) {
|
||||
date = makeDate(date);
|
||||
if (utc) {
|
||||
date.setUTCMinutes(minutes);
|
||||
} else {
|
||||
date.setMinutes(minutes);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set seconds
|
||||
*/
|
||||
export function setSeconds(date, seconds, utc) {
|
||||
date = makeDate(date);
|
||||
if (utc) {
|
||||
date.setUTCSeconds(seconds);
|
||||
} else {
|
||||
date.setSeconds(seconds);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
// Helper functions
|
||||
function getFirstThursday(year, utc) {
|
||||
const jan1 = new Date(Date.UTC(year, 0, 1));
|
||||
|
|
@ -329,5 +438,15 @@ export default {
|
|||
makeDate,
|
||||
formatDate,
|
||||
parseDate,
|
||||
getDate
|
||||
getDate,
|
||||
getDay,
|
||||
getISODay,
|
||||
getDayOfTheYear,
|
||||
getFirstDayOfTheYear,
|
||||
setDate,
|
||||
setFullYear,
|
||||
setMonth,
|
||||
setHours,
|
||||
setMinutes,
|
||||
setSeconds
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue