修改了格式

This commit is contained in:
2020-10-20 15:06:06 +08:00
parent b328b12f70
commit 8d93aa04d3
3 changed files with 136 additions and 155 deletions

View File

@@ -68,20 +68,23 @@ export function getweek(zhou?: number){
if(zhou != undefined){
now = now.day(now.day() + (zhou * 6));
}
const yue = now.month() + 1;
const yue = (now.month() + 1 < 10 ? '0' + (now.month() + 1) : (now.month() + 1));
const day = now.date() // 当前天
zhou = now.day(); // 当前周几
const year = now.year()
const startd = now.day(1).date();
const start = `${year}-${yue}-${startd}`
interface Date{
day: string;
list?: Array<any>;
}
const date: Array<Date> = [];
for(let i = 0; i < 7; i++){
console.log(i);
now = now.day(i + 1)
date[i] = {day: ""};
date[i].day = now.year() + "-" + (now.month() < 10 ? '0' + now.month() : now.month()) + "-" + (now.date() < 10 ? '0' + now.date() : now.date())
date[i].day = now.year() + "-" + (now.month() + 1 < 10 ? '0' + (now.month() + 1) : (now.month() + 1)) + "-" + (now.date() < 10 ? '0' + now.date() : now.date())
date[i].list = []
for(let j = 0;j < 24; j++){
date[i].list?.push({
@@ -90,8 +93,9 @@ export function getweek(zhou?: number){
})
}
}
const end = `${now.year()}-${(now.month() + 1 < 10 ? '0' + (now.month() + 1) : (now.month() + 1))}-${now.date()}`
console.log(date)
return {date, year, yue, day, zhou}
return {date, year, yue, day, zhou, start, end}
}