π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import { observer } from "mobx-react";
// plane imports
import { useTranslation } from "@plane/i18n";
import { CalendarLayoutIcon } from "@plane/propel/icons";
import { cn, renderFormattedDate, getDate } from "@plane/utils";
export type TReadonlyDateProps = {
className?: string;
hideIcon?: boolean;
value: Date | string | null;
placeholder?: string;
formatToken?: string;
};
export const ReadonlyDate = observer(function ReadonlyDate(props: TReadonlyDateProps) {
const { className, hideIcon = false, value, placeholder, formatToken } = props;
const { t } = useTranslation();
const formattedDate = value ? renderFormattedDate(getDate(value), formatToken) : null;
return (
<div className={cn("flex items-center gap-1 text-13", className)}>
{!hideIcon && <CalendarLayoutIcon className="size-4 flex-shrink-0" />}
<span className="flex-grow truncate">{formattedDate ?? placeholder ?? t("common.none")}</span>
</div>
);
});