取名小程序开发

This commit is contained in:
cjd
2025-11-05 00:22:09 +08:00
parent 271d207611
commit 6268c82b9c
24 changed files with 1508 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
function pad(value) {
return value < 10 ? `0${value}` : `${value}`;
}
function formatDate(date) {
const year = date.getFullYear();
const month = pad(date.getMonth() + 1);
const day = pad(date.getDate());
return `${year}-${month}-${day}`;
}
function formatTime(date) {
const hours = pad(date.getHours());
const minutes = pad(date.getMinutes());
return `${hours}:${minutes}`;
}
module.exports = {
formatDate,
formatTime
};