forked from rage/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRegistrationLink.js
More file actions
31 lines (26 loc) · 917 Bytes
/
RegistrationLink.js
File metadata and controls
31 lines (26 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React from "react"
import moment from "moment"
import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary"
const start = moment("01/01/2018", "DD/MM/YYYY")
const summerStart = moment("18/03/2019", "DD/MM/YYYY")
const autumnStart = moment("06/05/2019", "DD/MM/YYYY")
const springLink =
"https://www.avoin.helsinki.fi/palvelut/esittely.aspx?o=127404110"
const summerLink =
"https://www.avoin.helsinki.fi/palvelut/esittely.aspx?o=127404483"
const autumnLink =
"https://www.avoin.helsinki.fi/palvelut/esittely.aspx?o=127404483"
function getLink() {
const currentDate = moment()
if (currentDate.isBetween(start, summerStart)) {
return springLink
}
if (currentDate.isBetween(start, autumnStart)) {
return summerLink
}
return springLink
}
const RegistrationLink = () => {
return <a href={getLink()}>{getLink()}</a>
}
export default withSimpleErrorBoundary(RegistrationLink)