added short timezone code to times
This commit is contained in:
parent
4b1ede7130
commit
94e89276c2
@ -57,6 +57,19 @@ const Info = ({ data, loading, infoActive, setInfoActive, currentVideo }) => {
|
||||
)
|
||||
: []
|
||||
|
||||
const dateString = `${new Date()}`
|
||||
let tzShort =
|
||||
// Works for the majority of modern browsers
|
||||
dateString.match(/\(([^\)]+)\)$/) ||
|
||||
// IE outputs date strings in a different format:
|
||||
dateString.match(/([A-Z]+) [\d]{4}$/)
|
||||
|
||||
if (tzShort) {
|
||||
// Old Firefox uses the long timezone name (e.g., "Central
|
||||
// Daylight Time" instead of "CDT")
|
||||
tzShort = tzShort[1].match(/[A-Z]/g).join('')
|
||||
}
|
||||
|
||||
return (
|
||||
<InfoLayout loading={loading}>
|
||||
{embedURL ? (
|
||||
@ -102,7 +115,11 @@ const Info = ({ data, loading, infoActive, setInfoActive, currentVideo }) => {
|
||||
<Fragment>
|
||||
<Title>{translations.en.nextStream}:</Title>
|
||||
{futureStreams.map(feeditem => (
|
||||
<VideoCard key={feeditem.start} {...feeditem} />
|
||||
<VideoCard
|
||||
key={feeditem.start}
|
||||
tzShort={tzShort}
|
||||
{...feeditem}
|
||||
/>
|
||||
))}
|
||||
</Fragment>
|
||||
) : null}
|
||||
|
@ -184,6 +184,7 @@ export const VideoCard = ({
|
||||
hasPassed,
|
||||
videoUrl,
|
||||
onClickButton,
|
||||
tzShort,
|
||||
}) => {
|
||||
const startDate = new Date(start)
|
||||
const utcDate = zonedTimeToUtc(startDate, 'Europe/Berlin')
|
||||
@ -197,7 +198,7 @@ export const VideoCard = ({
|
||||
<Span bold colour={colours.midnight}>
|
||||
{hasPassed
|
||||
? format(zonedDate, 'dd/MM/yy')
|
||||
: format(zonedDate, 'do LLLL y // HH:mm')}
|
||||
: `${format(zonedDate, 'do LLLL y // HH:mm')} ${tzShort}`}
|
||||
</Span>
|
||||
</DateLabel>
|
||||
{videoUrl && hasPassed ? (
|
||||
|
Loading…
Reference in New Issue
Block a user