mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
22 lines
737 B
TypeScript
22 lines
737 B
TypeScript
import { ItemDetailListCellProps } from './types';
|
|
|
|
import { formatPartialIsoDateUTC } from '/@/renderer/utils/format';
|
|
import { SEPARATOR_STRING } from '/@/shared/api/utils';
|
|
|
|
export const ReleaseDateColumn = ({ song }: ItemDetailListCellProps) => {
|
|
const row = song as typeof song & { originalDate?: null | string };
|
|
const releaseDate = row.releaseDate;
|
|
if (!releaseDate) {
|
|
return <> </>;
|
|
}
|
|
|
|
const originalDate =
|
|
row.originalDate && row.originalDate !== releaseDate ? row.originalDate : null;
|
|
|
|
if (originalDate) {
|
|
return `${formatPartialIsoDateUTC(originalDate)}${SEPARATOR_STRING}${formatPartialIsoDateUTC(releaseDate)}`;
|
|
}
|
|
|
|
return formatPartialIsoDateUTC(releaseDate);
|
|
};
|