Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): explain dates outside the allowed range

Andrejb5fb8da93ac8
diff --git a/apps/web/src/components/common/date-picker/date-picker-menu.tsx b/apps/web/src/components/common/date-picker/date-picker-menu.tsx
index 617fc4db1..0e84ddd17 100644
--- a/apps/web/src/components/common/date-picker/date-picker-menu.tsx
+++ b/apps/web/src/components/common/date-picker/date-picker-menu.tsx
@@ -55,8 +55,17 @@ export function DatePickerMenu({
const quickDates = getQuickDates(now, weekStartsOn).filter((item) =>
isAllowed(item.date, bounds),
);
- const typed = parseDateQuery(query, now, weekStartsOn);
+ const typed = parseDateQuery(query, now, weekStartsOn, bounds?.before);
const typedDate = typed && isAllowed(typed, bounds) ? typed : null;
+ const typedOutOfRange =
+ typed && !typedDate
+ ? t(
+ bounds?.before && typed < bounds.before
+ ? "tasks:datePicker.beforeStart"
+ : "tasks:datePicker.afterDue",
+ { date: formatPickerDay(typed) },
+ )
+ : undefined;
const options: OptionMenuItem[] = [
...(typedDate
@@ -133,6 +142,7 @@ export function DatePickerMenu({
onSelect={select}
onQueryChange={setQuery}
inputHint={value ? formatPickerDay(value) : undefined}
+ status={typedOutOfRange}
/>
{limitHint && <DateLimitHint>{limitHint}</DateLimitHint>}
</>
diff --git a/apps/web/src/components/common/date-picker/parse-date-query.test.ts b/apps/web/src/components/common/date-picker/parse-date-query.test.ts
index 5226d9504..ad31d0656 100644
--- a/apps/web/src/components/common/date-picker/parse-date-query.test.ts
+++ b/apps/web/src/components/common/date-picker/parse-date-query.test.ts
@@ -30,6 +30,11 @@ describe("parseDateQuery", () => {
expect(parse(query)).toEqual(expected);
});
+ it("moves a weekday past the earliest allowed day", () => {
+ expect(parseDateQuery("fri", now, 1, day(9, 17))).toEqual(day(9, 23));
+ expect(parseDateQuery("sat", now, 1, day(9, 17))).toEqual(day(9, 17));
+ });
+
it.each(["", "t", "soon", "feb 30", "2026-02-31", "ju 4"])(
"ignores %s",
(query) => {
diff --git a/apps/web/src/components/common/date-picker/parse-date-query.ts b/apps/web/src/components/common/date-picker/parse-date-query.ts
index c530b51d1..a24b4420e 100644
--- a/apps/web/src/components/common/date-picker/parse-date-query.ts
+++ b/apps/web/src/components/common/date-picker/parse-date-query.ts
@@ -70,6 +70,7 @@ export function parseDateQuery(
query: string,
now: Date,
weekStartsOn: Day,
+ earliest?: Date,
): Date | null {
const text = query.trim().toLowerCase().replace(/\s+/g, " ");
if (!text) return null;
@@ -96,7 +97,10 @@ export function parseDateQuery(
const weekday = text.match(/^(?:next |this |on )?([a-z]+)$/);
if (weekday) {
const index = matchPrefix(weekday[1], WEEKDAYS, 2);
- return index >= 0 ? nextDay(today, index as Day) : null;
+ if (index < 0) return null;
+ let date = nextDay(today, index as Day);
+ while (earliest && date < startOfDay(earliest)) date = addWeeks(date, 1);
+ return date;
}
const iso = text.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
diff --git a/i18n/az-AZ.json b/i18n/az-AZ.json
index 2e8be95d6..d60fde309 100644
--- a/i18n/az-AZ.json
+++ b/i18n/az-AZ.json
@@ -3290,7 +3290,9 @@
"thisWeekend": "Bu həftə sonu",
"nextWeek": "Gələn həftə",
"pickDate": "Tarix seç",
- "startsOn": "Başlayır: {{date}}"
+ "startsOn": "Başlayır: {{date}}",
+ "beforeStart": "{{date}} başlama tarixindən əvvəldir",
+ "afterDue": "{{date}} son tarixdən sonradır"
}
},
"invitations": {
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index 1f2dc9a1b..7cda2c885 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -3290,7 +3290,9 @@
"thisWeekend": "Dieses Wochenende",
"nextWeek": "Nächste Woche",
"pickDate": "Datum auswählen",
- "startsOn": "Beginnt {{date}}"
+ "startsOn": "Beginnt {{date}}",
+ "beforeStart": "{{date}} liegt vor dem Startdatum",
+ "afterDue": "{{date}} liegt nach dem Fälligkeitsdatum"
}
},
"invitations": {
diff --git a/i18n/el-GR.json b/i18n/el-GR.json
index 62dcad355..4d21e668d 100644
--- a/i18n/el-GR.json
+++ b/i18n/el-GR.json
@@ -3290,7 +3290,9 @@
"thisWeekend": "Αυτό το Σαββατοκύριακο",
"nextWeek": "Την επόμενη εβδομάδα",
"pickDate": "Επιλογή ημερομηνίας",
- "startsOn": "Ξεκινά {{date}}"
+ "startsOn": "Ξεκινά {{date}}",
+ "beforeStart": "Η {{date}} είναι πριν από την ημερομηνία έναρξης",
+ "afterDue": "Η {{date}} είναι μετά την προθεσμία"
}
},
"invitations": {
diff --git a/i18n/en-US.json b/i18n/en-US.json
index 964e698f2..e7c6b5683 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -3290,7 +3290,9 @@
"thisWeekend": "This weekend",
"nextWeek": "Next week",
"pickDate": "Pick a date",
- "startsOn": "Starts {{date}}"
+ "startsOn": "Starts {{date}}",
+ "beforeStart": "{{date}} is before the start date",
+ "afterDue": "{{date}} is after the due date"
}
},
"invitations": {
diff --git a/i18n/es-ES.json b/i18n/es-ES.json
index e9d14e52b..64153cee5 100644
--- a/i18n/es-ES.json
+++ b/i18n/es-ES.json
@@ -3347,7 +3347,9 @@
"thisWeekend": "Este fin de semana",
"nextWeek": "La próxima semana",
"pickDate": "Elegir una fecha",
- "startsOn": "Empieza: {{date}}"
+ "startsOn": "Empieza: {{date}}",
+ "beforeStart": "{{date}} es anterior a la fecha de inicio",
+ "afterDue": "{{date}} es posterior a la fecha límite"
}
},
"invitations": {
diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json
index 06c8aa25c..9931dca78 100644
--- a/i18n/fr-FR.json
+++ b/i18n/fr-FR.json
@@ -3347,7 +3347,9 @@
"thisWeekend": "Ce week-end",
"nextWeek": "La semaine prochaine",
"pickDate": "Choisir une date",
- "startsOn": "Commence le {{date}}"
+ "startsOn": "Commence le {{date}}",
+ "beforeStart": "{{date}} est avant la date de début",
+ "afterDue": "{{date}} est après l’échéance"
}
},
"invitations": {
diff --git a/i18n/hi-IN.json b/i18n/hi-IN.json
index e2be8ff69..b1a333a0a 100644
--- a/i18n/hi-IN.json
+++ b/i18n/hi-IN.json
@@ -3290,7 +3290,9 @@
"thisWeekend": "इस सप्ताहांत",
"nextWeek": "अगले सप्ताह",
"pickDate": "तारीख चुनें",
- "startsOn": "शुरुआत: {{date}}"
+ "startsOn": "शुरुआत: {{date}}",
+ "beforeStart": "{{date}} प्रारंभ तारीख से पहले है",
+ "afterDue": "{{date}} नियत तारीख के बाद है"
}
},
"invitations": {
diff --git a/i18n/id-ID.json b/i18n/id-ID.json
index 8fcced31e..d270462ce 100644
--- a/i18n/id-ID.json
+++ b/i18n/id-ID.json
@@ -3233,7 +3233,9 @@
"thisWeekend": "Akhir pekan ini",
"nextWeek": "Minggu depan",
"pickDate": "Pilih tanggal",
- "startsOn": "Mulai {{date}}"
+ "startsOn": "Mulai {{date}}",
+ "beforeStart": "{{date}} sebelum tanggal mulai",
+ "afterDue": "{{date}} setelah tenggat"
}
},
"invitations": {
diff --git a/i18n/it-IT.json b/i18n/it-IT.json
index 3a6a9afc7..22ea15e9e 100644
--- a/i18n/it-IT.json
+++ b/i18n/it-IT.json
@@ -3347,7 +3347,9 @@
"thisWeekend": "Questo fine settimana",
"nextWeek": "La prossima settimana",
"pickDate": "Scegli una data",
- "startsOn": "Inizia {{date}}"
+ "startsOn": "Inizia {{date}}",
+ "beforeStart": "{{date}} è prima della data di inizio",
+ "afterDue": "{{date}} è dopo la scadenza"
}
},
"invitations": {
diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json
index 8f2811587..b4c3a0b23 100644
--- a/i18n/ja-JP.json
+++ b/i18n/ja-JP.json
@@ -3233,7 +3233,9 @@
"thisWeekend": "今週末",
"nextWeek": "来週",
"pickDate": "日付を選択",
- "startsOn": "開始: {{date}}"
+ "startsOn": "開始: {{date}}",
+ "beforeStart": "{{date}} は開始日より前です",
+ "afterDue": "{{date}} は期日より後です"
}
},
"invitations": {
diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json
index 3ce41b27b..a9d267ebf 100644
--- a/i18n/ko-KR.json
+++ b/i18n/ko-KR.json
@@ -3233,7 +3233,9 @@
"thisWeekend": "이번 주말",
"nextWeek": "다음 주",
"pickDate": "날짜 선택",
- "startsOn": "시작: {{date}}"
+ "startsOn": "시작: {{date}}",
+ "beforeStart": "{{date}}은(는) 시작일 이전입니다",
+ "afterDue": "{{date}}은(는) 마감일 이후입니다"
}
},
"invitations": {
diff --git a/i18n/mk-MK.json b/i18n/mk-MK.json
index de21c6665..0b43416ff 100644
--- a/i18n/mk-MK.json
+++ b/i18n/mk-MK.json
@@ -3290,7 +3290,9 @@
"thisWeekend": "Овој викенд",
"nextWeek": "Следната недела",
"pickDate": "Избери датум",
- "startsOn": "Почнува: {{date}}"
+ "startsOn": "Почнува: {{date}}",
+ "beforeStart": "{{date}} е пред датумот на почеток",
+ "afterDue": "{{date}} е по рокот"
}
},
"invitations": {
diff --git a/i18n/nl-NL.json b/i18n/nl-NL.json
index 301d5eba0..cb6ba0006 100644
--- a/i18n/nl-NL.json
+++ b/i18n/nl-NL.json
@@ -3290,7 +3290,9 @@
"thisWeekend": "Dit weekend",
"nextWeek": "Volgende week",
"pickDate": "Kies een datum",
- "startsOn": "Begint {{date}}"
+ "startsOn": "Begint {{date}}",
+ "beforeStart": "{{date}} ligt vóór de startdatum",
+ "afterDue": "{{date}} ligt na de vervaldatum"
}
},
"invitations": {
diff --git a/i18n/pl-PL.json b/i18n/pl-PL.json
index a3129637b..d268e8a81 100644
--- a/i18n/pl-PL.json
+++ b/i18n/pl-PL.json
@@ -3686,7 +3686,9 @@
"thisWeekend": "Ten weekend",
"nextWeek": "Przyszły tydzień",
"pickDate": "Wybierz datę",
- "startsOn": "Początek: {{date}}"
+ "startsOn": "Początek: {{date}}",
+ "beforeStart": "{{date}} jest przed datą rozpoczęcia",
+ "afterDue": "{{date}} jest po terminie"
}
},
"press": {
diff --git a/i18n/pt-BR.json b/i18n/pt-BR.json
index 924964447..ee7377f92 100644
--- a/i18n/pt-BR.json
+++ b/i18n/pt-BR.json
@@ -3347,7 +3347,9 @@
"thisWeekend": "Este fim de semana",
"nextWeek": "Próxima semana",
"pickDate": "Escolher uma data",
- "startsOn": "Começa em {{date}}"
+ "startsOn": "Começa em {{date}}",
+ "beforeStart": "{{date}} é antes da data de início",
+ "afterDue": "{{date}} é depois do prazo"
}
},
"invitations": {
diff --git a/i18n/ru-RU.json b/i18n/ru-RU.json
index 8e7fc0662..35295effd 100644
--- a/i18n/ru-RU.json
+++ b/i18n/ru-RU.json
@@ -3456,7 +3456,9 @@
"thisWeekend": "В эти выходные",
"nextWeek": "На следующей неделе",
"pickDate": "Выбрать дату",
- "startsOn": "Начало: {{date}}"
+ "startsOn": "Начало: {{date}}",
+ "beforeStart": "{{date}} раньше даты начала",
+ "afterDue": "{{date}} позже срока"
}
},
"invitations": {
diff --git a/i18n/tr-TR.json b/i18n/tr-TR.json
index 36c1e7f64..b48599b2b 100644
--- a/i18n/tr-TR.json
+++ b/i18n/tr-TR.json
@@ -3290,7 +3290,9 @@
"thisWeekend": "Bu hafta sonu",
"nextWeek": "Gelecek hafta",
"pickDate": "Tarih seç",
- "startsOn": "Başlangıç: {{date}}"
+ "startsOn": "Başlangıç: {{date}}",
+ "beforeStart": "{{date}} başlangıç tarihinden önce",
+ "afterDue": "{{date}} bitiş tarihinden sonra"
}
},
"invitations": {
diff --git a/i18n/uk-UA.json b/i18n/uk-UA.json
index ec57ca094..06c19ae37 100644
--- a/i18n/uk-UA.json
+++ b/i18n/uk-UA.json
@@ -3404,7 +3404,9 @@
"thisWeekend": "Цими вихідними",
"nextWeek": "Наступного тижня",
"pickDate": "Вибрати дату",
- "startsOn": "Початок: {{date}}"
+ "startsOn": "Початок: {{date}}",
+ "beforeStart": "{{date}} раніше за дату початку",
+ "afterDue": "{{date}} пізніше за термін"
}
},
"invitations": {
diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json
index 7f075501f..e79e28d27 100644
--- a/i18n/vi-VN.json
+++ b/i18n/vi-VN.json
@@ -3233,7 +3233,9 @@
"thisWeekend": "Cuối tuần này",
"nextWeek": "Tuần sau",
"pickDate": "Chọn ngày",
- "startsOn": "Bắt đầu {{date}}"
+ "startsOn": "Bắt đầu {{date}}",
+ "beforeStart": "{{date}} trước ngày bắt đầu",
+ "afterDue": "{{date}} sau hạn chót"
}
},
"invitations": {
diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json
index 89f56c25a..9d0cd8c9a 100644
--- a/i18n/zh-CN.json
+++ b/i18n/zh-CN.json
@@ -3233,7 +3233,9 @@
"thisWeekend": "本周末",
"nextWeek": "下周",
"pickDate": "选择日期",
- "startsOn": "开始于 {{date}}"
+ "startsOn": "开始于 {{date}}",
+ "beforeStart": "{{date}} 早于开始日期",
+ "afterDue": "{{date}} 晚于截止日期"
}
},
"invitations": {
diff --git a/i18n/zh-TW.json b/i18n/zh-TW.json
index e59f5c423..37db4dcf8 100644
--- a/i18n/zh-TW.json
+++ b/i18n/zh-TW.json
@@ -3233,7 +3233,9 @@
"thisWeekend": "本週末",
"nextWeek": "下週",
"pickDate": "選擇日期",
- "startsOn": "開始於 {{date}}"
+ "startsOn": "開始於 {{date}}",
+ "beforeStart": "{{date}} 早於開始日期",
+ "afterDue": "{{date}} 晚於截止日期"
}
},
"invitations": {