+1 day to event date so highlight is active on day of event

main
Ryan Moon 2023-08-22 23:53:32 -04:00
parent c07bed6fb4
commit fcc9274ead
13 changed files with 35 additions and 36 deletions

View File

@ -58,7 +58,7 @@
@media only screen and (max-width: 600px) { @media only screen and (max-width: 600px) {
.footer { .footer {
height: unset; height: unset;
padding: 0 2.5rem; padding: 0 2rem;
margin: 1rem 0; margin: 1rem 0;
.who, .who,

View File

@ -65,7 +65,7 @@ header {
@media only screen and (max-width: 600px) { @media only screen and (max-width: 600px) {
header { header {
grid-template-columns: 5.5rem calc(100% - 5.5rem); grid-template-columns: 5.5rem calc(100% - 5.5rem);
padding: 2.5rem 2.5rem 1rem 2.5rem; padding: 2.5rem 2rem 1rem 2rem;
.logo h1 { .logo h1 {
font-size: 1rem; font-size: 1rem;

View File

@ -14,7 +14,7 @@ main {
} }
@media only screen and (max-width: 600px) { @media only screen and (max-width: 600px) {
main { padding: 2rem } main { padding: 2rem 1.5rem }
} }
html { html {

View File

@ -2,16 +2,18 @@
const events = await queryContent('event') const events = await queryContent('event')
.sort({ date: -1 }) .sort({ date: -1 })
.only(['title', 'slug', 'location', 'date', 'time', 'meetup']) .only(['title', 'slug', 'location', 'date', 'day', 'time', 'meetup'])
.limit(3) .limit(3)
.find() .find()
import { format, isBefore, parseISO } from "date-fns"; import { format, parseISO, addDays, isPast } from "date-fns";
for (let i = 0; i < events.length; i++) { for (let i = 0; i < events.length; i++) {
let date = parseISO(events[i].date) let date = addDays(parseISO(events[i].date), 1)
events[i].past = isBefore(date, new Date()) events[i].past = isPast(date)
events[i].date = format(date, 'EEE, MMM d')
// issue with 1 day ahead
// events[i].date = format(date, 'EEE, MMM d')
} }
</script> </script>
@ -23,7 +25,7 @@
<div class="info"> <div class="info">
<NuxtLink :to="'/event/' + event.slug"><h5>{{ event.title }}</h5></NuxtLink> <NuxtLink :to="'/event/' + event.slug"><h5>{{ event.title }}</h5></NuxtLink>
<p class="location">{{ event.location }}</p> <p class="location">{{ event.location }}</p>
<p>{{ event.date }} · {{ event.time }}</p> <p>{{ event.day }} · {{ event.time }}</p>
</div> </div>
<div v-bind:class="(event.meetup)?'attend both':'attend bottom'" > <div v-bind:class="(event.meetup)?'attend both':'attend bottom'" >
<NuxtLink v-if="!event.past" :href="'/login?action=attend&?ref=' + event.slug" >Attend event</NuxtLink> <NuxtLink v-if="!event.past" :href="'/login?action=attend&?ref=' + event.slug" >Attend event</NuxtLink>

View File

@ -2,6 +2,7 @@
title: title:
slug: slug:
date: MM-DD-YYYY date: MM-DD-YYYY
day:
published: MMM D, YYYY published: MMM D, YYYY
location: location:
address: address:

View File

@ -2,6 +2,7 @@
title: Monthly Meetup title: Monthly Meetup
slug: monthly-meetup-5-11-2023 slug: monthly-meetup-5-11-2023
date: 2023-05-11 date: 2023-05-11
day: Tue, May 11
published: 2023-04-28 published: 2023-04-28
location: Frog Alley Brewing Co location: Frog Alley Brewing Co
address: 108 State St, Schenectady address: 108 State St, Schenectady

View File

@ -2,6 +2,7 @@
title: Monthly Meetup title: Monthly Meetup
slug: monthly-meetup-6-28-2023 slug: monthly-meetup-6-28-2023
date: 2023-06-28 date: 2023-06-28
day: Wed, Jun 28
published: 2023-06-04 published: 2023-06-04
location: Druther's Brewing Company location: Druther's Brewing Company
address: 7 Southside Drive, Clifton Park address: 7 Southside Drive, Clifton Park

View File

@ -2,6 +2,7 @@
title: Monthly Meetup title: Monthly Meetup
slug: monthly-meetup-7-26-2023 slug: monthly-meetup-7-26-2023
date: 2023-07-26 date: 2023-07-26
day: Wed, Jul 26
published: 2023-07-16 published: 2023-07-16
location: Druther's Brewing Company location: Druther's Brewing Company
address: 221 Harborside Drive, Schenectady address: 221 Harborside Drive, Schenectady

View File

@ -2,6 +2,7 @@
title: Monthly Meetup title: Monthly Meetup
slug: monthly-meetup-8-23-2023 slug: monthly-meetup-8-23-2023
date: 2023-08-23 date: 2023-08-23
day: Wed, Aug 23
published: 2023-08-11 published: 2023-08-11
location: Druther's Brewing Company location: Druther's Brewing Company
address: 221 Harborside Drive, Schenectady address: 221 Harborside Drive, Schenectady

View File

@ -6,7 +6,6 @@ export default defineNuxtConfig({
'@nuxt/content', '@nuxt/content',
'@nuxtjs/device', '@nuxtjs/device',
'nuxt-directus', 'nuxt-directus',
'nuxt-time',
], ],
directus: { directus: {

40
package-lock.json generated
View File

@ -8,6 +8,7 @@
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"date-fns": "^2.30.0", "date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
"sass": "^1.63.6", "sass": "^1.63.6",
"vee-validate": "^4.10.8" "vee-validate": "^4.10.8"
}, },
@ -17,8 +18,7 @@
"@nuxtjs/device": "^3.1.0", "@nuxtjs/device": "^3.1.0",
"@types/node": "^18.16.19", "@types/node": "^18.16.19",
"nuxt": "^3.6.2", "nuxt": "^3.6.2",
"nuxt-directus": "^5.5.0", "nuxt-directus": "^5.5.0"
"nuxt-time": "^0.1.0"
} }
}, },
"node_modules/@ampproject/remapping": { "node_modules/@ampproject/remapping": {
@ -4904,6 +4904,14 @@
"url": "https://opencollective.com/date-fns" "url": "https://opencollective.com/date-fns"
} }
}, },
"node_modules/date-fns-tz": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-2.0.0.tgz",
"integrity": "sha512-OAtcLdB9vxSXTWHdT8b398ARImVwQMyjfYGkKD2zaGpHseG2UPHbHjXELReErZFxWdSLph3c2zOaaTyHfOhERQ==",
"peerDependencies": {
"date-fns": ">=2.0.0"
}
},
"node_modules/debug": { "node_modules/debug": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@ -9477,17 +9485,6 @@
"@nuxt/kit": "^3.0.0" "@nuxt/kit": "^3.0.0"
} }
}, },
"node_modules/nuxt-time": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/nuxt-time/-/nuxt-time-0.1.0.tgz",
"integrity": "sha512-kWk17FWL6fnIQO2kTvpkABFRn8MDzoabIOAjMpL3SVwbeKVQbdTRt20BJs2o4nCldZxUVXoGj4ClK0RDASuSLg==",
"dev": true,
"dependencies": {
"@nuxt/kit": "^3.2.0",
"defu": "^6.1.1",
"pathe": "^1.0.0"
}
},
"node_modules/nypm": { "node_modules/nypm": {
"version": "0.2.2", "version": "0.2.2",
"resolved": "https://registry.npmjs.org/nypm/-/nypm-0.2.2.tgz", "resolved": "https://registry.npmjs.org/nypm/-/nypm-0.2.2.tgz",
@ -17030,6 +17027,12 @@
"@babel/runtime": "^7.21.0" "@babel/runtime": "^7.21.0"
} }
}, },
"date-fns-tz": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-2.0.0.tgz",
"integrity": "sha512-OAtcLdB9vxSXTWHdT8b398ARImVwQMyjfYGkKD2zaGpHseG2UPHbHjXELReErZFxWdSLph3c2zOaaTyHfOhERQ==",
"requires": {}
},
"debug": { "debug": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@ -20362,17 +20365,6 @@
"@nuxt/kit": "^3.0.0" "@nuxt/kit": "^3.0.0"
} }
}, },
"nuxt-time": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/nuxt-time/-/nuxt-time-0.1.0.tgz",
"integrity": "sha512-kWk17FWL6fnIQO2kTvpkABFRn8MDzoabIOAjMpL3SVwbeKVQbdTRt20BJs2o4nCldZxUVXoGj4ClK0RDASuSLg==",
"dev": true,
"requires": {
"@nuxt/kit": "^3.2.0",
"defu": "^6.1.1",
"pathe": "^1.0.0"
}
},
"nypm": { "nypm": {
"version": "0.2.2", "version": "0.2.2",
"resolved": "https://registry.npmjs.org/nypm/-/nypm-0.2.2.tgz", "resolved": "https://registry.npmjs.org/nypm/-/nypm-0.2.2.tgz",

View File

@ -14,11 +14,11 @@
"@nuxtjs/device": "^3.1.0", "@nuxtjs/device": "^3.1.0",
"@types/node": "^18.16.19", "@types/node": "^18.16.19",
"nuxt": "^3.6.2", "nuxt": "^3.6.2",
"nuxt-directus": "^5.5.0", "nuxt-directus": "^5.5.0"
"nuxt-time": "^0.1.0"
}, },
"dependencies": { "dependencies": {
"date-fns": "^2.30.0", "date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
"sass": "^1.63.6", "sass": "^1.63.6",
"vee-validate": "^4.10.8" "vee-validate": "^4.10.8"
} }

View File

@ -26,6 +26,7 @@
email: values.email, email: values.email,
password: values.password, password: values.password,
external_identifier: slug, external_identifier: slug,
role: process.env.DIRECTUS_ROLE,
}) })
} catch (e) {} } catch (e) {}
} }