diff --git a/src/components/Info/index.js b/src/components/Info/index.js index 7efe87e..d01683e 100644 --- a/src/components/Info/index.js +++ b/src/components/Info/index.js @@ -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 ( {embedURL ? ( @@ -102,7 +115,11 @@ const Info = ({ data, loading, infoActive, setInfoActive, currentVideo }) => { {translations.en.nextStream}: {futureStreams.map(feeditem => ( - + ))} ) : null} diff --git a/src/components/Info/styles.js b/src/components/Info/styles.js index 7ad07da..6933a43 100644 --- a/src/components/Info/styles.js +++ b/src/components/Info/styles.js @@ -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 = ({ {hasPassed ? format(zonedDate, 'dd/MM/yy') - : format(zonedDate, 'do LLLL y // HH:mm')} + : `${format(zonedDate, 'do LLLL y // HH:mm')} ${tzShort}`} {videoUrl && hasPassed ? (