...
 
Commits (2)
......@@ -25,6 +25,8 @@ const eventOrganizersQuery = graphql`
`
const EventList = props => {
const renderEvent = event => {
/* TODO: Make API return proper UTC datetimes */
const startTime = moment(event.start_time).utcOffset(1)
return (
<Link to={event.path} className="event" key={event.id}>
<div className="event-image">
......@@ -35,23 +37,23 @@ const EventList = props => {
<header className="event-header">
<span className="event-date">
<span className="event-date-weekday">
{moment(event.start_time).format('dddd')}{' '}
{startTime.format('dddd')}{' '}
</span>
<span className="event-date-day-month">
{moment(event.start_time).format('D.')}{' '}
{moment(event.start_time).format('MMMM')}{' '}
{startTime.format('D.')}{' '}
{startTime.format('MMMM')}{' '}
</span>
{/* Only specify year if different. */}
{!moment(event.start_time).isSame(new Date(), 'year') && (
{!startTime.isSame(new Date(), 'year') && (
<span className="event-date-year">
{moment(event.start_time).format('YYYY')}{' '}
{startTime.format('YYYY')}{' '}
</span>
)}
</span>
<h2 className="event-title">{event.title}</h2>
<div className="event-meta">
<span className="event-start">
kl. {moment(event.start_time).format('HH:mm')}
kl. {startTime.format('HH:mm')}
</span>
{event.event_types && event.event_types.length && (
<div className="event-types">
......
import React from 'react'
import PropTypes from 'prop-types'
import { graphql, Link } from 'gatsby'
import moment from 'moment'
import 'moment/locale/nb'
import Meta from '../components/Meta'
import Layout from '../components/Layout'
import EventList from '../components/EventList'
moment.locale('nb')
export default class EventOrganizerPage extends React.Component {
render() {
const { data, pageContext } = this.props
......
......@@ -51,6 +51,8 @@ export const EventTemplate = ({
organizers,
}) => {
const hasFeaturedMedia = featuredMedia && !!featuredMedia.localFile
/* TODO: Make API return proper UTC datetimes */
const start = moment(startTime).utcOffset(1)
return (
<section className="event-page">
<div className="event-hero">
......@@ -72,25 +74,25 @@ export const EventTemplate = ({
</div>
<div className="event-date">
<span className="event-date-weekday">
{moment(startTime).format('dddd')}{' '}
{start.format('dddd')}{' '}
</span>
<span className="event-date-day">
{moment(startTime).format('D.')}{' '}
{start.format('D.')}{' '}
</span>
<span className="event-date-month">
{moment(startTime).format('MMMM')}{' '}
{start.format('MMMM')}{' '}
</span>
{/* Only specify year if different. */}
{!moment(startTime).isSame(new Date(), 'year') && (
{!start.isSame(new Date(), 'year') && (
<span className="event-date-year">
{moment(startTime).format('YYYY')}{' '}
{start.format('YYYY')}{' '}
</span>
)}
</div>
<div className="event-time">
{/* TODO: make the API stop assuming event duration is 2 hours when unspecified? */}
kl. {moment(startTime).format('HH:mm')}
{endTime && <>&mdash;{moment(endTime).format('HH:mm')}</>}
kl. {start.format('HH:mm')}
{endTime && <>&mdash;{moment(endTime).utcOffset(1).format('HH:mm')}</>}
</div>
<div className="price">
Pris: {formatPrices(priceRegular, priceStudent)}
......
This diff is collapsed.