Send email on RSVP

This commit is contained in:
2017-02-26 14:51:22 +00:00
parent 274d5a3629
commit d2c57c5ef0
5 changed files with 71 additions and 28 deletions

View File

@@ -3,40 +3,14 @@ import Layout from '../../components/Layout';
import fetchQL from '../../core/fetchQL';
import Rsvp from './Rsvp';
import NotFound from '../notFound/NotFound';
import { rsvpEndDate } from '../../config';
import { rsvpEndDate, getRsvpEnd } from '../../config';
let title = 'RSVP';
const months = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
];
export default {
path: '/rsvp/:password',
getRsvpEnd() {
const date = rsvpEndDate.getDate();
let dateSuffix = 'th';
if (date === 1 || date === 21 || date === 31) { dateSuffix = 'st'; }
if (date === 2 || date === 22) { dateSuffix = 'nd'; }
if (date === 3 || date === 23) { dateSuffix = 'rd'; }
const month = months[rsvpEndDate.getMonth()];
const year = rsvpEndDate.getFullYear();
return `${date}${dateSuffix} ${month} ${year}`;
},
isEditable() {
return new Date() < rsvpEndDate;
},
@@ -68,7 +42,7 @@ export default {
<Rsvp
title={title}
people={people}
rsvpEnd={this.getRsvpEnd()}
rsvpEnd={getRsvpEnd()}
isEditable={this.isEditable()}
/>
</Layout>