You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
willaengine/resources/js/Global/utils/date/date.js

20 lines
497 B

const formatToYMD = function (date = null, split = "-" ) {
if (!date) {
date = new Date();
}
let month = `${date.getMonth() + 1}`;
let day = `${date.getDate()}`;
const year = date.getFullYear();
if (month.length < 2) month = `0${month}`;
if (day.length < 2) day = `0${day}`;
return [year, month, day].join(split);
};
const addMinutes = function (date, minutes) {
return new Date(date.getTime() + minutes*60000);
};
export {formatToYMD, addMinutes};