fix: calculating weeks in a year
This commit is contained in:
parent
eda6ca4b1a
commit
3aefee124a
@ -141,7 +141,16 @@ export class ScheduleComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get currentWeek(): number {
|
get currentWeek(): number {
|
||||||
let result = (weekInYear(this.startWeek) - weekInYear(this.startTerm)) + 1;
|
const startTermWeek = weekInYear(this.startTerm);
|
||||||
|
let startWeekNumber;
|
||||||
|
const startWeek = addDays(this.startWeek, 6);
|
||||||
|
|
||||||
|
if (startWeek.getFullYear() > this.startTerm.getFullYear())
|
||||||
|
startWeekNumber = weekInYear(new Date(this.startTerm.getFullYear(), 11, 29)) + weekInYear(startWeek);
|
||||||
|
else
|
||||||
|
startWeekNumber = weekInYear(startWeek);
|
||||||
|
|
||||||
|
let result = startWeekNumber - startTermWeek + 1;
|
||||||
|
|
||||||
if (result <= 0)
|
if (result <= 0)
|
||||||
result = 1;
|
result = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user