- Added {timeAgo(link.created_at)}
+ Added {calculateTimeAgo(link.created_at)}
by{" "}
{link.created_by_detail.is_bot
diff --git a/web/components/core/sidebar/progress-chart.tsx b/web/components/core/sidebar/progress-chart.tsx
index 4433e4c09..3c445760d 100644
--- a/web/components/core/sidebar/progress-chart.tsx
+++ b/web/components/core/sidebar/progress-chart.tsx
@@ -1,9 +1,9 @@
import React from "react";
-
+import { eachDayOfInterval } from "date-fns";
// ui
import { LineGraph } from "components/ui";
// helpers
-import { getDatesInRange, renderShortNumericDateFormat } from "helpers/date-time.helper";
+import { renderFormattedDateWithoutYear } from "helpers/date-time.helper";
//types
import { TCompletionChartDistribution } from "types";
@@ -42,25 +42,25 @@ const DashedLine = ({ series, lineGenerator, xScale, yScale }: any) =>
const ProgressChart: React.FC = ({ distribution, startDate, endDate, totalIssues }) => {
const chartData = Object.keys(distribution).map((key) => ({
- currentDate: renderShortNumericDateFormat(key),
+ currentDate: renderFormattedDateWithoutYear(key),
pending: distribution[key],
}));
const generateXAxisTickValues = () => {
- const dates = getDatesInRange(startDate, endDate);
+ const dates = eachDayOfInterval({ start: new Date(startDate), end: new Date(endDate) });
const maxDates = 4;
const totalDates = dates.length;
- if (totalDates <= maxDates) return dates.map((d) => renderShortNumericDateFormat(d));
+ if (totalDates <= maxDates) return dates.map((d) => renderFormattedDateWithoutYear(d));
else {
const interval = Math.ceil(totalDates / maxDates);
const limitedDates = [];
- for (let i = 0; i < totalDates; i += interval) limitedDates.push(renderShortNumericDateFormat(dates[i]));
+ for (let i = 0; i < totalDates; i += interval) limitedDates.push(renderFormattedDateWithoutYear(dates[i]));
- if (!limitedDates.includes(renderShortNumericDateFormat(dates[totalDates - 1])))
- limitedDates.push(renderShortNumericDateFormat(dates[totalDates - 1]));
+ if (!limitedDates.includes(renderFormattedDateWithoutYear(dates[totalDates - 1])))
+ limitedDates.push(renderFormattedDateWithoutYear(dates[totalDates - 1]));
return limitedDates;
}
diff --git a/web/components/cycles/active-cycle-details.tsx b/web/components/cycles/active-cycle-details.tsx
index 47beaa262..c184f80c9 100644
--- a/web/components/cycles/active-cycle-details.tsx
+++ b/web/components/cycles/active-cycle-details.tsx
@@ -28,7 +28,7 @@ import { ViewIssueLabel } from "components/issues";
// icons
import { AlarmClock, AlertTriangle, ArrowRight, CalendarDays, Star, Target } from "lucide-react";
// helpers
-import { renderShortDateWithYearFormat, findHowManyDaysLeft } from "helpers/date-time.helper";
+import { renderFormattedDate, findHowManyDaysLeft } from "helpers/date-time.helper";
import { truncateText } from "helpers/string.helper";
// types
import { ICycle } from "types";
@@ -267,12 +267,12 @@ export const ActiveCycleDetails: React.FC = observer((props
- {renderShortDateWithYearFormat(startDate)}
+ {renderFormattedDate(startDate)}
- {renderShortDateWithYearFormat(endDate)}
+ {renderFormattedDate(endDate)}
diff --git a/web/components/cycles/cycles-board-card.tsx b/web/components/cycles/cycles-board-card.tsx
index d43d56872..ca0d487e8 100644
--- a/web/components/cycles/cycles-board-card.tsx
+++ b/web/components/cycles/cycles-board-card.tsx
@@ -10,7 +10,7 @@ import { Avatar, AvatarGroup, CustomMenu, Tooltip, LayersIcon, CycleGroupIcon }
// icons
import { Info, LinkIcon, Pencil, Star, Trash2 } from "lucide-react";
// helpers
-import { findHowManyDaysLeft, renderShortDate, renderShortMonthDate } from "helpers/date-time.helper";
+import { findHowManyDaysLeft, renderFormattedDate } from "helpers/date-time.helper";
import { copyTextToClipboard } from "helpers/string.helper";
// types
import { ICycle, TCycleGroups } from "types";
@@ -53,8 +53,6 @@ export const CyclesBoardCard: FC = (props) => {
const currentCycle = CYCLE_STATUS.find((status) => status.value === cycleStatus);
- const areYearsEqual = startDate.getFullYear() === endDate.getFullYear();
-
const cycleTotalIssues =
cycle.backlog_issues +
cycle.unstarted_issues +
@@ -228,8 +226,7 @@ export const CyclesBoardCard: FC = (props) => {
{isDateValid ? (
- {areYearsEqual ? renderShortDate(startDate, "_ _") : renderShortMonthDate(startDate, "_ _")} -{" "}
- {areYearsEqual ? renderShortDate(endDate, "_ _") : renderShortMonthDate(endDate, "_ _")}
+ {renderFormattedDate(startDate) ?? "_ _"} - {renderFormattedDate(endDate) ?? "_ _"}
) : (
No due date
diff --git a/web/components/cycles/cycles-list-item.tsx b/web/components/cycles/cycles-list-item.tsx
index 9ea26ab39..cb1c53f41 100644
--- a/web/components/cycles/cycles-list-item.tsx
+++ b/web/components/cycles/cycles-list-item.tsx
@@ -1,7 +1,6 @@
import { FC, MouseEvent, useState } from "react";
import Link from "next/link";
import { useRouter } from "next/router";
-
// stores
import { useMobxStore } from "lib/mobx/store-provider";
// hooks
@@ -13,7 +12,7 @@ import { CustomMenu, Tooltip, CircularProgressIndicator, CycleGroupIcon, AvatarG
// icons
import { Check, Info, LinkIcon, Pencil, Star, Trash2, User2 } from "lucide-react";
// helpers
-import { findHowManyDaysLeft, renderShortDate, renderShortMonthDate } from "helpers/date-time.helper";
+import { findHowManyDaysLeft, renderFormattedDate } from "helpers/date-time.helper";
import { copyTextToClipboard } from "helpers/string.helper";
// types
import { ICycle, TCycleGroups } from "types";
@@ -64,8 +63,6 @@ export const CyclesListItem: FC = (props) => {
const renderDate = cycle.start_date || cycle.end_date;
- const areYearsEqual = startDate.getFullYear() === endDate.getFullYear();
-
const completionPercentage = (cycle.completed_issues / cycleTotalIssues) * 100;
const progress = isNaN(completionPercentage) ? 0 : Math.floor(completionPercentage);
@@ -204,10 +201,8 @@ export const CyclesListItem: FC = (props) => {
{renderDate && (
-
- {areYearsEqual ? renderShortDate(startDate, "_ _") : renderShortMonthDate(startDate, "_ _")}
- {" - "}
- {areYearsEqual ? renderShortDate(endDate, "_ _") : renderShortMonthDate(endDate, "_ _")}
+
+ {renderFormattedDate(startDate) ?? "_ _"} - {renderFormattedDate(endDate) ?? "_ _"}
)}
diff --git a/web/components/cycles/gantt-chart/blocks.tsx b/web/components/cycles/gantt-chart/blocks.tsx
index 76a4d9235..8f05c45ab 100644
--- a/web/components/cycles/gantt-chart/blocks.tsx
+++ b/web/components/cycles/gantt-chart/blocks.tsx
@@ -1,9 +1,8 @@
import { useRouter } from "next/router";
-
// ui
import { Tooltip, ContrastIcon } from "@plane/ui";
// helpers
-import { renderShortDate } from "helpers/date-time.helper";
+import { renderFormattedDate } from "helpers/date-time.helper";
// types
import { ICycle } from "types";
@@ -35,7 +34,7 @@ export const CycleGanttBlock = ({ data }: { data: ICycle }) => {
{data?.name}
- {renderShortDate(data?.start_date ?? "")} to {renderShortDate(data?.end_date ?? "")}
+ {renderFormattedDate(data?.start_date ?? "")} to {renderFormattedDate(data?.end_date ?? "")}
}
diff --git a/web/components/cycles/sidebar.tsx b/web/components/cycles/sidebar.tsx
index f3576fb00..e73168008 100644
--- a/web/components/cycles/sidebar.tsx
+++ b/web/components/cycles/sidebar.tsx
@@ -32,9 +32,8 @@ import { copyUrlToClipboard } from "helpers/string.helper";
import {
findHowManyDaysLeft,
isDateGreaterThanToday,
- renderDateFormat,
- renderShortDate,
- renderShortMonthDate,
+ renderFormattedPayloadDate,
+ renderFormattedDate,
} from "helpers/date-time.helper";
// types
import { ICycle, IIssueFilterOptions } from "types";
@@ -141,8 +140,8 @@ export const CycleDetailsSidebar: React.FC = observer((props) => {
if (isDateValidForExistingCycle) {
submitChanges({
- start_date: renderDateFormat(`${watch("start_date")}`),
- end_date: renderDateFormat(`${watch("end_date")}`),
+ start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
+ end_date: renderFormattedPayloadDate(`${watch("end_date")}`),
});
setToastAlert({
type: "success",
@@ -168,8 +167,8 @@ export const CycleDetailsSidebar: React.FC = observer((props) => {
if (isDateValid) {
submitChanges({
- start_date: renderDateFormat(`${watch("start_date")}`),
- end_date: renderDateFormat(`${watch("end_date")}`),
+ start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
+ end_date: renderFormattedPayloadDate(`${watch("end_date")}`),
});
setToastAlert({
type: "success",
@@ -209,8 +208,8 @@ export const CycleDetailsSidebar: React.FC = observer((props) => {
if (isDateValidForExistingCycle) {
submitChanges({
- start_date: renderDateFormat(`${watch("start_date")}`),
- end_date: renderDateFormat(`${watch("end_date")}`),
+ start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
+ end_date: renderFormattedPayloadDate(`${watch("end_date")}`),
});
setToastAlert({
type: "success",
@@ -236,8 +235,8 @@ export const CycleDetailsSidebar: React.FC = observer((props) => {
if (isDateValid) {
submitChanges({
- start_date: renderDateFormat(`${watch("start_date")}`),
- end_date: renderDateFormat(`${watch("end_date")}`),
+ start_date: renderFormattedPayloadDate(`${watch("start_date")}`),
+ end_date: renderFormattedPayloadDate(`${watch("end_date")}`),
});
setToastAlert({
type: "success",
@@ -302,9 +301,6 @@ export const CycleDetailsSidebar: React.FC = observer((props) => {
const endDate = new Date(watch("end_date") ?? cycleDetails.end_date ?? "");
const startDate = new Date(watch("start_date") ?? cycleDetails.start_date ?? "");
- const areYearsEqual =
- startDate.getFullYear() === endDate.getFullYear() || isNaN(startDate.getFullYear()) || isNaN(endDate.getFullYear());
-
const currentCycle = CYCLE_STATUS.find((status) => status.value === cycleStatus);
const issueCount =
@@ -396,19 +392,17 @@ export const CycleDetailsSidebar: React.FC = observer((props) => {
- {areYearsEqual
- ? renderShortDate(startDate, "No date selected")
- : renderShortMonthDate(startDate, "No date selected")}
+ {renderFormattedDate(startDate) ?? "No date selected"}
@@ -450,19 +444,17 @@ export const CycleDetailsSidebar: React.FC = observer((props) => {
<>
- {areYearsEqual
- ? renderShortDate(endDate, "No date selected")
- : renderShortMonthDate(endDate, "No date selected")}
+ {renderFormattedDate(endDate) ?? "No date selected"}
diff --git a/web/components/cycles/transfer-issues-modal.tsx b/web/components/cycles/transfer-issues-modal.tsx
index dd462e360..f47c1ddaa 100644
--- a/web/components/cycles/transfer-issues-modal.tsx
+++ b/web/components/cycles/transfer-issues-modal.tsx
@@ -136,7 +136,7 @@ export const TransferIssuesModal: React.FC = observer(({ isOpen, handleCl
{option?.name}
- {option.status}
+ {option.status.toLocaleLowerCase()}
diff --git a/web/components/exporter/single-export.tsx b/web/components/exporter/single-export.tsx
index a72d05bf2..d2502cefb 100644
--- a/web/components/exporter/single-export.tsx
+++ b/web/components/exporter/single-export.tsx
@@ -2,7 +2,7 @@ import { useState, FC } from "react";
// ui
import { Button } from "@plane/ui";
// helpers
-import { renderShortDateWithYearFormat } from "helpers/date-time.helper";
+import { renderFormattedDate } from "helpers/date-time.helper";
// types
import { IExportData } from "types";
@@ -50,7 +50,7 @@ export const SingleExport: FC = ({ service, refreshing }) => {
- {renderShortDateWithYearFormat(service.created_at)}|
+ {renderFormattedDate(service.created_at)}|
Exported by {service?.initiated_by_detail?.display_name}
diff --git a/web/components/gantt-chart/blocks/blocks-display.tsx b/web/components/gantt-chart/blocks/blocks-display.tsx
index 52a997909..0c368090d 100644
--- a/web/components/gantt-chart/blocks/blocks-display.tsx
+++ b/web/components/gantt-chart/blocks/blocks-display.tsx
@@ -1,10 +1,9 @@
import { FC } from "react";
-
// hooks
import { useChart } from "../hooks";
// helpers
import { ChartDraggable } from "../helpers/draggable";
-import { renderDateFormat } from "helpers/date-time.helper";
+import { renderFormattedPayloadDate } from "helpers/date-time.helper";
// types
import { IBlockUpdateData, IGanttBlock } from "../types";
@@ -64,8 +63,8 @@ export const GanttChartBlocks: FC = (props) => {
// call the block update handler with the updated dates
blockUpdateHandler(block.data, {
- start_date: renderDateFormat(updatedStartDate),
- target_date: renderDateFormat(updatedTargetDate),
+ start_date: renderFormattedPayloadDate(updatedStartDate) ?? undefined,
+ target_date: renderFormattedPayloadDate(updatedTargetDate) ?? undefined,
});
};
diff --git a/web/components/gantt-chart/sidebar/cycle-sidebar.tsx b/web/components/gantt-chart/sidebar/cycle-sidebar.tsx
index 13d56e7f5..b7cb41837 100644
--- a/web/components/gantt-chart/sidebar/cycle-sidebar.tsx
+++ b/web/components/gantt-chart/sidebar/cycle-sidebar.tsx
@@ -94,7 +94,7 @@ export const CycleGanttSidebar: React.FC = (props) => {
<>
{blocks ? (
blocks.map((block, index) => {
- const duration = findTotalDaysInRange(block.start_date ?? "", block.target_date ?? "", true);
+ const duration = findTotalDaysInRange(block.start_date ?? "", block.target_date ?? "");
return (
= (props) => {
<>
{blocks ? (
blocks.map((block, index) => {
- const duration = findTotalDaysInRange(block.start_date ?? "", block.target_date ?? "", true);
+ const duration = findTotalDaysInRange(block.start_date ?? "", block.target_date ?? "");
return (
= (props) => {
<>
{blocks ? (
blocks.map((block, index) => {
- const duration = findTotalDaysInRange(block.start_date ?? "", block.target_date ?? "", true);
+ const duration = findTotalDaysInRange(block.start_date ?? "", block.target_date ?? "");
return (
= (props) => {
<>
{blocks ? (
blocks.map((block, index) => {
- const duration = findTotalDaysInRange(block.start_date ?? "", block.target_date ?? "", true);
+ const duration = findTotalDaysInRange(block.start_date ?? "", block.target_date ?? "");
return (
= (props) => {
- {renderShortDateWithYearFormat(issue.created_at ?? "")}
+ {renderFormattedDate(issue.created_at ?? "")}
diff --git a/web/components/inbox/main-content.tsx b/web/components/inbox/main-content.tsx
index 3a0faf248..a5d4e18a7 100644
--- a/web/components/inbox/main-content.tsx
+++ b/web/components/inbox/main-content.tsx
@@ -4,7 +4,6 @@ import { observer } from "mobx-react-lite";
import useSWR from "swr";
import { useForm } from "react-hook-form";
import { AlertTriangle, CheckCircle2, Clock, Copy, ExternalLink, Inbox, XCircle } from "lucide-react";
-
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
// components
@@ -13,7 +12,7 @@ import { InboxIssueActivity } from "components/inbox";
// ui
import { Loader, StateGroupIcon } from "@plane/ui";
// helpers
-import { renderShortDateWithYearFormat } from "helpers/date-time.helper";
+import { renderFormattedDate } from "helpers/date-time.helper";
// types
import { IInboxIssue, IIssue } from "types";
import { EUserWorkspaceRoles } from "constants/workspace";
@@ -193,12 +192,12 @@ export const InboxMainContent: React.FC = observer(() => {
{new Date(issueDetails.issue_inbox[0].snoozed_till ?? "") < new Date() ? (
This issue was snoozed till{" "}
- {renderShortDateWithYearFormat(issueDetails.issue_inbox[0].snoozed_till ?? "")}.
+ {renderFormattedDate(issueDetails.issue_inbox[0].snoozed_till ?? "")}.
) : (
This issue has been snoozed till{" "}
- {renderShortDateWithYearFormat(issueDetails.issue_inbox[0].snoozed_till ?? "")}.
+ {renderFormattedDate(issueDetails.issue_inbox[0].snoozed_till ?? "")}.
)}
>
diff --git a/web/components/integration/single-import.tsx b/web/components/integration/single-import.tsx
index 433747f31..18eeef3ac 100644
--- a/web/components/integration/single-import.tsx
+++ b/web/components/integration/single-import.tsx
@@ -3,7 +3,7 @@ import { CustomMenu } from "@plane/ui";
// icons
import { Trash2 } from "lucide-react";
// helpers
-import { renderShortDateWithYearFormat } from "helpers/date-time.helper";
+import { renderFormattedDate } from "helpers/date-time.helper";
// types
import { IImporterService } from "types";
// constants
@@ -39,7 +39,7 @@ export const SingleImport: React.FC