Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

chore: module date validation (#3565)

Anmol Singh Bhatia30aaec909784
diff --git a/web/components/modules/form.tsx b/web/components/modules/form.tsx
index 661d31ef55..be0792caad 100644
--- a/web/components/modules/form.tsx
+++ b/web/components/modules/form.tsx
@@ -70,7 +70,7 @@ export const ModuleForm: React.FC<Props> = ({
const startDate = watch("start_date");
const targetDate = watch("target_date");
- const minDate = startDate ? new Date(startDate) : new Date();
+ const minDate = startDate ? new Date(startDate) : null;
minDate?.setDate(minDate.getDate());
const maxDate = targetDate ? new Date(targetDate) : null;
@@ -159,7 +159,6 @@ export const ModuleForm: React.FC<Props> = ({
onChange={(date) => onChange(date ? renderFormattedPayloadDate(date) : null)}
buttonVariant="border-with-text"
placeholder="Start date"
- minDate={new Date()}
maxDate={maxDate ?? undefined}
tabIndex={3}
/>
diff --git a/web/components/modules/sidebar.tsx b/web/components/modules/sidebar.tsx
index c724780051..947885f9af 100644
--- a/web/components/modules/sidebar.tsx
+++ b/web/components/modules/sidebar.tsx
@@ -168,18 +168,6 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
if (!watch("target_date") || watch("target_date") === "") endDateButtonRef.current?.click();
if (watch("start_date") && watch("target_date") && watch("start_date") !== "" && watch("start_date") !== "") {
- if (!isDateGreaterThanToday(`${watch("target_date")}`)) {
- setToastAlert({
- type: "error",
- title: "Error!",
- message: "Unable to create module in past date. Please enter a valid date.",
- });
- reset({
- ...moduleDetails,
- });
- return;
- }
-
submitChanges({
start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
target_date: renderFormattedPayloadDate(`${watch("target_date")}`),
@@ -198,18 +186,6 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
if (!watch("start_date") || watch("start_date") === "") endDateButtonRef.current?.click();
if (watch("start_date") && watch("target_date") && watch("start_date") !== "" && watch("start_date") !== "") {
- if (!isDateGreaterThanToday(`${watch("target_date")}`)) {
- setToastAlert({
- type: "error",
- title: "Error!",
- message: "Unable to create module in past date. Please enter a valid date.",
- });
- reset({
- ...moduleDetails,
- });
- return;
- }
-
submitChanges({
start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
target_date: renderFormattedPayloadDate(`${watch("target_date")}`),