mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: build errors
This commit is contained in:
parent
52b5a9c766
commit
d41edb780d
@ -48,7 +48,7 @@ export const CreateApiTokenModal: React.FC<Props> = (props) => {
|
||||
const csvData = {
|
||||
Title: data.label,
|
||||
Description: data.description,
|
||||
Expiry: data.expired_at ? renderFormattedDate(data.expired_at) : "Never expires",
|
||||
Expiry: data.expired_at ? renderFormattedDate(data.expired_at)?.replace(",", " ") ?? "" : "Never expires",
|
||||
"Secret key": data.token ?? "",
|
||||
};
|
||||
|
||||
|
@ -63,8 +63,8 @@ export const GanttChartBlocks: FC<GanttChartBlocksProps> = (props) => {
|
||||
|
||||
// call the block update handler with the updated dates
|
||||
blockUpdateHandler(block.data, {
|
||||
start_date: renderFormattedPayloadDate(updatedStartDate),
|
||||
target_date: renderFormattedPayloadDate(updatedTargetDate),
|
||||
start_date: renderFormattedPayloadDate(updatedStartDate) ?? undefined,
|
||||
target_date: renderFormattedPayloadDate(updatedTargetDate) ?? undefined,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -52,7 +52,9 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
||||
const [showAllIssues, setShowAllIssues] = useState(false);
|
||||
const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month";
|
||||
|
||||
const issueIdList = groupedIssueIds ? groupedIssueIds[renderFormattedPayloadDate(date.date)] : null;
|
||||
const formattedDatePayload = renderFormattedPayloadDate(date.date);
|
||||
if (!formattedDatePayload) return null;
|
||||
const issueIdList = groupedIssueIds ? groupedIssueIds[formattedDatePayload] : null;
|
||||
|
||||
const totalIssues = issueIdList?.length ?? 0;
|
||||
return (
|
||||
@ -78,7 +80,7 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
||||
|
||||
{/* content */}
|
||||
<div className="h-full w-full">
|
||||
<Droppable droppableId={renderFormattedPayloadDate(date.date)} isDropDisabled={false}>
|
||||
<Droppable droppableId={formattedDatePayload} isDropDisabled={false}>
|
||||
{(provided, snapshot) => (
|
||||
<div
|
||||
className={`h-full w-full select-none overflow-y-auto ${
|
||||
@ -100,7 +102,7 @@ export const CalendarDayTile: React.FC<Props> = observer((props) => {
|
||||
<div className="px-2 py-1">
|
||||
<CalendarQuickAddIssueForm
|
||||
formKey="target_date"
|
||||
groupId={renderFormattedPayloadDate(date.date)}
|
||||
groupId={formattedDatePayload}
|
||||
prePopulatedData={{
|
||||
target_date: renderFormattedPayloadDate(date.date),
|
||||
}}
|
||||
|
@ -10,8 +10,8 @@ export const getCurrentHookAsCSV = (
|
||||
) => ({
|
||||
id: webhook?.id || "",
|
||||
url: webhook?.url || "",
|
||||
created_at: renderFormattedPayloadDate(webhook?.created_at || ""),
|
||||
updated_at: renderFormattedPayloadDate(webhook?.updated_at || ""),
|
||||
created_at: renderFormattedPayloadDate(webhook?.created_at || "") ?? "",
|
||||
updated_at: renderFormattedPayloadDate(webhook?.updated_at || "") ?? "",
|
||||
is_active: webhook?.is_active?.toString() || "",
|
||||
secret_key: secretKey || "",
|
||||
project: webhook?.project?.toString() || "",
|
||||
|
@ -34,7 +34,7 @@ export const ActivityGraph: React.FC<Props> = ({ activities }) => {
|
||||
const date = new Date(year, month, 1);
|
||||
|
||||
while (date.getMonth() === month && date < new Date()) {
|
||||
dates.push(renderFormattedPayloadDate(new Date(date)));
|
||||
dates.push(renderFormattedPayloadDate(new Date(date)) ?? "");
|
||||
date.setDate(date.getDate() + 1);
|
||||
}
|
||||
|
||||
|
@ -73,16 +73,18 @@ export const generateCalendarData = (currentStructure: ICalendarPayload | null,
|
||||
|
||||
const date = new Date(year, month, dayNumber + 1);
|
||||
|
||||
currentWeekObject[renderFormattedPayloadDate(date)] = {
|
||||
date,
|
||||
year,
|
||||
month,
|
||||
day: dayNumber + 1,
|
||||
week: weekNumber,
|
||||
is_current_month: date.getMonth() === month,
|
||||
is_current_week: getWeekNumberOfDate(date) === getWeekNumberOfDate(new Date()),
|
||||
is_today: date.toDateString() === new Date().toDateString(),
|
||||
};
|
||||
const formattedDatePayload = renderFormattedPayloadDate(date);
|
||||
if (formattedDatePayload)
|
||||
currentWeekObject[formattedDatePayload] = {
|
||||
date,
|
||||
year,
|
||||
month,
|
||||
day: dayNumber + 1,
|
||||
week: weekNumber,
|
||||
is_current_month: date.getMonth() === month,
|
||||
is_current_week: getWeekNumberOfDate(date) === getWeekNumberOfDate(new Date()),
|
||||
is_today: date.toDateString() === new Date().toDateString(),
|
||||
};
|
||||
}
|
||||
|
||||
calendarData[`y-${year}`][`m-${month}`][`w-${weekNumber}`] = currentWeekObject;
|
||||
|
@ -19,17 +19,17 @@ export const renderFormattedDate = (date: string | Date): string | null => {
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string | null} formatted date in the format of MMM dd
|
||||
* @returns {string} formatted date in the format of MMM dd
|
||||
* @description Returns date in the formatted format
|
||||
* @param {string | Date} date
|
||||
* @example renderShortDateFormat("2024-01-01") // Jan 01
|
||||
*/
|
||||
export const renderFormattedDateWithoutYear = (date: string | Date): string | null => {
|
||||
if (!date) return null;
|
||||
export const renderFormattedDateWithoutYear = (date: string | Date): string => {
|
||||
if (!date) return "";
|
||||
// Parse the date to check if it is valid
|
||||
const parsedDate = new Date(date);
|
||||
// Check if the parsed date is valid before formatting
|
||||
if (!isValid(parsedDate)) return null; // Return null for invalid dates
|
||||
if (!isValid(parsedDate)) return ""; // Return empty string for invalid dates
|
||||
// Format the date in short format (MMM dd)
|
||||
const formattedDate = format(parsedDate, "MMM dd");
|
||||
return formattedDate;
|
||||
|
Loading…
Reference in New Issue
Block a user