diff --git a/public/js/app/components/preview/CourseFacts.jsx b/public/js/app/components/preview/CourseFacts.jsx index 4161f46c..b6a5de50 100644 --- a/public/js/app/components/preview/CourseFacts.jsx +++ b/public/js/app/components/preview/CourseFacts.jsx @@ -98,7 +98,7 @@ const startDate = (labels, memoData) => memoData.roundsStartDate ? ( <>
{getDateFormat(memoData.roundsStartDate[0])}
+{getDateFormat(memoData.roundsStartDate[0], memoData.languageOfInstructions)}
> ) : ( <> diff --git a/public/js/app/components/preview/CourseMemoLinks.jsx b/public/js/app/components/preview/CourseMemoLinks.jsx index 800c9ee8..a2febe26 100644 --- a/public/js/app/components/preview/CourseMemoLinks.jsx +++ b/public/js/app/components/preview/CourseMemoLinks.jsx @@ -1,26 +1,24 @@ import React from 'react' import PropTypes from 'prop-types' +import { getDateFormat } from '../../util/helpers' import Popup from './Popup' -const formatVersion = (language = 'sv', version) => { - const unixTime = Date.parse(version) +const formatVersionDateAndTime = (language = 'sv', lastChangedDateTime) => { + const unixTime = Date.parse(lastChangedDateTime) if (unixTime) { - if (language === 'sv') { - return new Date(unixTime).toLocaleString('sv-SE') - } else { - const options = { day: 'numeric', month: 'short', year: 'numeric' } - return new Date(unixTime).toLocaleDateString('en-GB', options) - } + const date = new Date(unixTime) + const time = date.toLocaleTimeString() + return `${getDateFormat(date, language)} ${time}` } return null } -const version = (language, labels, memoVersion) => - memoVersion ? ( +const version = (language, labels, lastChangedDateTime, memoData) => + lastChangedDateTime ? ( <>{`${labels.latest} ${formatVersion(language, memoVersion)}`}
+{`Ver ${memoData.version} - ${formatVersionDateAndTime(language, lastChangedDateTime)}`}
> ) : ( <> @@ -41,7 +39,7 @@ const pdfLink = labels => ( const CourseMemoLinks = ({ language, labels, memoData = {} }) => (