Skip to content
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
3 changes: 2 additions & 1 deletion src/components/QuickCaptureModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ export class QuickCaptureModal extends Modal {
}

parseDate(dateString: string): Date {
return new Date(dateString);
const [year, month, day] = dateString.split('-').map(Number);
return new Date(year, month - 1, day); // month is 0-indexed in JavaScript Date
}

onClose() {
Expand Down
22 changes: 14 additions & 8 deletions src/components/task-view/forecast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,14 @@ export class ForecastComponent extends Component {
const sortedDates = Array.from(dateMap.keys()).sort();

sortedDates.forEach((dateKey) => {
const date = new Date(dateKey);
const tasks = dateMap.get(dateKey)!;

const today = new Date(this.currentDate);
today.setHours(0, 0, 0, 0);
// Parse the date components from the string "YYYY-MM-DD"
const [year, month, day] = dateKey.split('-').map(Number);
// Create date with local components (month is 0-indexed in JavaScript)
const date = new Date(year, month - 1, day);
const tasks = dateMap.get(dateKey)!;

const today = new Date(this.currentDate);
today.setHours(0, 0, 0, 0);

const dayDiff = Math.round(
(date.getTime() - today.getTime()) / (1000 * 3600 * 24)
Expand Down Expand Up @@ -914,12 +917,15 @@ export class ForecastComponent extends Component {
});
const sortedDates = Array.from(dateMap.keys()).sort();
sortedDates.forEach((dateKey) => {
const date = new Date(dateKey);
const tasks = dateMap.get(dateKey)!;
// Parse the date components from the string "YYYY-MM-DD"
const [year, month, day] = dateKey.split('-').map(Number);
// Create date with local components (month is 0-indexed in JavaScript)
const date = new Date(year, month - 1, day);
const tasks = dateMap.get(dateKey)!;

const selectedDate = new Date(this.selectedDate);
selectedDate.setHours(0, 0, 0, 0);

const dayDiff = Math.round(
(date.getTime() - selectedDate.getTime()) / (1000 * 3600 * 24)
);
Expand Down