Files
sundynix-pets/pets-fe/utils/date.js
T
Blizzard c72cf24f56
ci-cd / verify (push) Successful in 5s
ci-cd / deploy (push) Skipped
Complete core mini program flows
2026-10-04 09:26:58 +08:00

15 lines
422 B
JavaScript

function localDate(date = new Date()) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
}
function shiftDate(value, days) {
const date = new Date(`${value}T12:00:00`);
date.setDate(date.getDate() + days);
return localDate(date);
}
module.exports = { localDate, shiftDate };