www-new/components/EventSetting.tsx

35 lines
809 B
TypeScript
Raw Normal View History

2021-05-16 03:22:06 -04:00
import React from "react";
2021-06-09 07:16:40 -04:00
import styles from "./EventSetting.module.css";
2021-05-16 03:22:06 -04:00
interface Props {
date: Date;
online: boolean;
location: string;
}
export function EventSetting(props: Props) {
const date = props.date.toLocaleDateString("en-US", {
day: "numeric",
month: "long",
year: "numeric",
});
const time = props.date.toLocaleTimeString("en-US", {
hour: "numeric",
minute: "numeric",
2021-06-09 07:16:40 -04:00
timeZoneName: "short",
2021-05-16 03:22:06 -04:00
});
const location = props.online ? `Online - ${props.location}` : props.location;
2021-06-09 07:16:40 -04:00
const separator = <span className={styles.separator}> | </span>;
2021-05-16 03:22:06 -04:00
return (
<div className={styles.container}>
<time dateTime={props.date.toISOString()}>{date}</time>
2021-06-09 07:16:40 -04:00
{separator}
<span>{time}</span>
2021-06-09 07:16:40 -04:00
{separator}
{location}
2021-05-16 03:22:06 -04:00
</div>
);
}