日历样式完成

This commit is contained in:
2020-10-13 16:44:32 +08:00
parent 651fb0f692
commit 51f0be0fec
4 changed files with 261 additions and 1 deletions

View File

@@ -48,3 +48,34 @@ export function getdate(yue?: number){
return {date, year, yue, day, zhou};
}
export function getweek(zhou?: number){
let now = dayjs()
if(zhou != undefined){
now = now.day(now.day() + (zhou * 6));
}
const yue = now.month() + 1;
const day = now.date() // 当前天
zhou = now.day(); // 当前周几
const year = now.year()
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].list = []
for(let j = 0;j < 24; j++){
date[i].list?.push({
start:"",
num:""
})
}
}
console.log(date)
return {date, year, yue, day, zhou}
}