/** * 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 { CalendarOutline } from "@makeplane/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 (
{!hideIcon && } {formattedDate ?? placeholder ?? t("common.none")}
); });