diff --git a/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx b/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx index be0770d3..1502e26b 100644 --- a/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx +++ b/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx @@ -22,21 +22,11 @@ const TorrentGeneralInfo: FC = observer(() => { return null; } - const torrent = TorrentStore.torrents[UIStore?.activeModal?.hash]; + const torrent = TorrentStore.torrents[UIStore.activeModal.hash]; if (torrent == null) { return null; } - let dateAdded = null; - if (torrent.dateAdded) { - dateAdded = new Date(torrent.dateAdded * 1000); - } - - let creation = null; - if (torrent.dateCreated) { - creation = new Date(torrent.dateCreated * 1000); - } - const VALUE_NOT_AVAILABLE = ( @@ -57,14 +47,14 @@ const TorrentGeneralInfo: FC = observer(() => { - {dateAdded - ? `${i18n.date(dateAdded, { + {torrent.dateAdded > 0 + ? i18n.date(new Date(torrent.dateAdded * 1000), { year: 'numeric', month: 'long', day: '2-digit', hour: 'numeric', minute: 'numeric', - })}` + }) : VALUE_NOT_AVAILABLE} @@ -87,6 +77,22 @@ const TorrentGeneralInfo: FC = observer(() => { + + + + + + {torrent.dateFinished > 0 + ? i18n.date(new Date(torrent.dateFinished * 1000), { + year: 'numeric', + month: 'long', + day: '2-digit', + hour: 'numeric', + minute: 'numeric', + }) + : VALUE_NOT_AVAILABLE} + + @@ -136,14 +142,14 @@ const TorrentGeneralInfo: FC = observer(() => { - {creation - ? `${i18n.date(creation, { + {torrent.dateCreated > 0 + ? i18n.date(new Date(torrent.dateCreated * 1000), { year: 'numeric', month: 'long', day: '2-digit', hour: 'numeric', minute: 'numeric', - })}` + }) : VALUE_NOT_AVAILABLE} diff --git a/client/src/javascript/i18n/strings/en.json b/client/src/javascript/i18n/strings/en.json index 33d57e75..f8646677 100644 --- a/client/src/javascript/i18n/strings/en.json +++ b/client/src/javascript/i18n/strings/en.json @@ -280,6 +280,7 @@ "torrents.details.general.connected": "{connected} connected of {total}", "torrents.details.general.date.added": "Added", "torrents.details.general.date.created": "Creation Date", + "torrents.details.general.date.finished": "Finished", "torrents.details.general.downloaded": "Downloaded", "torrents.details.general.free.disk.space": "Free Disk Space", "torrents.details.general.hash": "Hash",