diff --git a/src/components/common/VideoItem.astro b/src/components/common/VideoItem.astro new file mode 100644 index 0000000..c1906ee --- /dev/null +++ b/src/components/common/VideoItem.astro @@ -0,0 +1,76 @@ +--- +// Properties +const { + ID, + Title, + Creator, + Views, + UploadDate, + Length +} = Astro.props + +// i18n +import { t } from "i18next" + +// Format Published Date +const DateFormat = new Date(UploadDate * 1000).toLocaleDateString() + +// Format Video Length +// Thanks to "mingjunlu" for helping out with the time format + +// Format Views +const ViewsConversion = Intl.NumberFormat('en', { notation: 'compact'}) +const ViewsFormat = ViewsConversion.format(Views) +--- + + + + + + + {Title} + {t("watch.By")} {Creator} + {ViewsFormat} {t("watch.Views")} - {DateFormat} + + + + \ No newline at end of file
{Title}
{t("watch.By")} {Creator}
{ViewsFormat} {t("watch.Views")} - {DateFormat}