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 (
|
return (
|
||||||
<InfoLayout loading={loading}>
|
<InfoLayout loading={loading}>
|
||||||
{embedURL ? (
|
{embedURL ? (
|
||||||
@ -102,7 +115,11 @@ const Info = ({ data, loading, infoActive, setInfoActive, currentVideo }) => {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<Title>{translations.en.nextStream}:</Title>
|
<Title>{translations.en.nextStream}:</Title>
|
||||||
{futureStreams.map(feeditem => (
|
{futureStreams.map(feeditem => (
|
||||||
<VideoCard key={feeditem.start} {...feeditem} />
|
<VideoCard
|
||||||
|
key={feeditem.start}
|
||||||
|
tzShort={tzShort}
|
||||||
|
{...feeditem}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
) : null}
|
) : null}
|
||||||
|
@ -184,6 +184,7 @@ export const VideoCard = ({
|
|||||||
hasPassed,
|
hasPassed,
|
||||||
videoUrl,
|
videoUrl,
|
||||||
onClickButton,
|
onClickButton,
|
||||||
|
tzShort,
|
||||||
}) => {
|
}) => {
|
||||||
const startDate = new Date(start)
|
const startDate = new Date(start)
|
||||||
const utcDate = zonedTimeToUtc(startDate, 'Europe/Berlin')
|
const utcDate = zonedTimeToUtc(startDate, 'Europe/Berlin')
|
||||||
@ -197,7 +198,7 @@ export const VideoCard = ({
|
|||||||
<Span bold colour={colours.midnight}>
|
<Span bold colour={colours.midnight}>
|
||||||
{hasPassed
|
{hasPassed
|
||||||
? format(zonedDate, 'dd/MM/yy')
|
? format(zonedDate, 'dd/MM/yy')
|
||||||
: format(zonedDate, 'do LLLL y // HH:mm')}
|
: `${format(zonedDate, 'do LLLL y // HH:mm')} ${tzShort}`}
|
||||||
</Span>
|
</Span>
|
||||||
</DateLabel>
|
</DateLabel>
|
||||||
{videoUrl && hasPassed ? (
|
{videoUrl && hasPassed ? (
|
||||||
|
Loading…
Reference in New Issue
Block a user