Skip to content

Commit

Permalink
Merge pull request #179 from poap-xyz/release/v1.10.2
Browse files Browse the repository at this point in the history
Release v1.10.2
  • Loading branch information
jm42 authored Apr 14, 2024
2 parents e847d11 + b439673 commit f8223f3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion netlify/edge-functions/event.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import axios from 'https://esm.sh/axios'
import dayjs from 'https://esm.sh/dayjs'
import localizedFormat from 'https://esm.sh/dayjs/plugin/localizedFormat'

dayjs.extend(localizedFormat)

const FAMILY_URL = 'https://poap.family'
const FAMILY_API_URL = 'https://api.poap.family'
Expand Down Expand Up @@ -90,7 +94,7 @@ export default async function handler(request, context) {
const title = escapeHtml(eventInfo.event.name)
const description = escapeHtml(
`[ ${eventInfo.supply} + ${eventInfo.emailReservations} ] ` +
`${eventInfo.event.start_date}` +
`${dayjs(eventInfo.event.start_date).format('ll')}` +
`${eventInfo.event.city && eventInfo.event.country
? ` ${eventInfo.event.city}, ${eventInfo.event.country}`
: ''
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/poap-family",
"version": "1.10.1",
"version": "1.10.2",
"author": {
"name": "POAP",
"url": "https://poap.xyz"
Expand Down
3 changes: 2 additions & 1 deletion src/components/EventInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Card from './Card'
import Stats from './Stats'
import TokenImageZoom from './TokenImageZoom'
import EventButtons from './EventButtons'
import { formatDate } from '../utils/date'
import '../styles/event-info.css'

function EventInfo({ event, stats = {}, highlightStat, buttons = [], children }) {
Expand All @@ -14,7 +15,7 @@ function EventInfo({ event, stats = {}, highlightStat, buttons = [], children })
</div>
<div className="event-data">
<h1>{event.name}</h1>
<div className="event-date">{event.start_date}</div>
<div className="event-date">{formatDate(event.start_date)}</div>
{event.city && event.country && <div className="place">{event.city}, {event.country}</div>}
<Stats stats={stats} highlight={highlightStat} />
<EventButtons event={event} buttons={buttons} viewInGallery={true} />
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Events.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { findEventsCollections } from '../loaders/collection'
import { IGNORED_OWNERS } from '../models/address'
import { filterAndSortInCommon, mergeEventsInCommon } from '../models/in-common'
import { parseEventIds, parseExpiryDates } from '../models/event'
import { formatDate } from '../utils/date'
import Timestamp from '../components/Timestamp'
import Card from '../components/Card'
import EventButtons from '../components/EventButtons'
Expand Down Expand Up @@ -721,7 +722,7 @@ function Events() {
</div>
<div className="event-data">
<h2>{event.name}</h2>
<div className="event-date">{event.start_date}</div>
<div className="event-date">{formatDate(event.start_date)}</div>
{event.city && event.country && <div className="place">{event.city}, {event.country}</div>}
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/utils/date.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import localizedFormat from 'dayjs/plugin/localizedFormat'

dayjs.extend(relativeTime)
dayjs.extend(localizedFormat)

export function formatDate(date) {
return dayjs(date).format('ll')
}

export function formatDateAgo(ts) {
if (typeof ts === 'number') {
Expand Down

0 comments on commit f8223f3

Please sign in to comment.