www-new/components/EventSetting.tsx

36 lines
849 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 (
2021-05-24 02:00:47 -04:00
<div>
2021-06-09 07:16:40 -04:00
<time className={styles.setting} dateTime={props.date.toISOString()}>
{date}
</time>
{separator}
<span className={styles.setting}>{time}</span>
{separator}
{location}
2021-05-16 03:22:06 -04:00
</div>
);
}