Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: follow setting when quick scheduling next week (#3373) #3550

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { PlannerService } from '../planner.service';
import { first } from 'rxjs/operators';
import { fadeAnimation } from '../../../ui/animations/fade.ani';
import { dateStrToUtcDate } from '../../../util/date-str-to-utc-date';
import { DateAdapter } from '@angular/material/core';

@Component({
selector: 'dialog-schedule-task',
Expand Down Expand Up @@ -78,6 +79,7 @@ export class DialogScheduleTaskComponent implements AfterViewInit {
private _taskService: TaskService,
private _reminderService: ReminderService,
private _plannerService: PlannerService,
private readonly _dateAdapter: DateAdapter<unknown>,
miqh marked this conversation as resolved.
Show resolved Hide resolved
) {}

async ngAfterViewInit(): Promise<void> {
Expand Down Expand Up @@ -327,9 +329,14 @@ export class DialogScheduleTaskComponent implements AfterViewInit {
this.selectedDate = tomorrow;
break;
case 2:
const nextMonday = tDate;
nextMonday.setDate(nextMonday.getDate() + ((1 + 7 - nextMonday.getDay()) % 7));
this.selectedDate = nextMonday;
const nextFirstDayOfWeek = tDate;
const dayOffset =
(this._dateAdapter.getFirstDayOfWeek() -
this._dateAdapter.getDayOfWeek(nextFirstDayOfWeek) +
7) %
7 || 7;
miqh marked this conversation as resolved.
Show resolved Hide resolved
nextFirstDayOfWeek.setDate(nextFirstDayOfWeek.getDate() + dayOffset);
this.selectedDate = nextFirstDayOfWeek;
break;
case 3:
const nextMonth = tDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { PlannerActions } from '../../../planner/store/planner.actions';
import { combineDateAndTime } from '../../../../util/combine-date-and-time';
import { FocusModeService } from '../../../focus-mode/focus-mode.service';
import { isToday } from '../../../../util/is-today.util';
import { DateAdapter } from '@angular/material/core';

@Component({
selector: 'task-context-menu-inner',
Expand Down Expand Up @@ -159,6 +160,7 @@ export class TaskContextMenuInnerComponent implements AfterViewInit {
private readonly _globalConfigService: GlobalConfigService,
private readonly _store: Store,
private readonly _focusModeService: FocusModeService,
private readonly _dateAdapter: DateAdapter<unknown>,
) {}

ngAfterViewInit(): void {
Expand Down Expand Up @@ -495,9 +497,14 @@ export class TaskContextMenuInnerComponent implements AfterViewInit {
this._schedule(tomorrow);
break;
case 2:
const nextMonday = tDate;
nextMonday.setDate(nextMonday.getDate() + ((1 + 7 - nextMonday.getDay()) % 7));
this._schedule(nextMonday);
const nextFirstDayOfWeek = tDate;
const dayOffset =
(this._dateAdapter.getFirstDayOfWeek() -
this._dateAdapter.getDayOfWeek(nextFirstDayOfWeek) +
7) %
7 || 7;
nextFirstDayOfWeek.setDate(nextFirstDayOfWeek.getDate() + dayOffset);
this._schedule(nextFirstDayOfWeek);
break;
case 3:
const nextMonth = tDate;
Expand Down
Loading