Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull schedule dates from Firebase #545

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/components/Schedule/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ const CurrentTime = ({ start, duration, numCols }) => {

export const TimelineColumn = ({ hackathonStart, duration, numCols }) => {
duration = Math.floor(Math.max(0, duration))
const dayOneDate = hackathonStart.toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
})
const dayTwoDate = new Date(hackathonStart.getTime() + 24 * 60 * 60 * 1000).toLocaleDateString(
'en-US',
{
month: 'short',
day: 'numeric',
year: 'numeric',
}
)
return (
<TimelineColumnContainer duration={duration}>
<CurrentTime start={hackathonStart} duration={duration} numCols={numCols} />
Expand All @@ -90,7 +103,7 @@ export const TimelineColumn = ({ hackathonStart, duration, numCols }) => {
return (
<TimelineBlock key={i}>
<TimelineLabel hourOffset={i}>
<strong>November 18th, 2023</strong>
<strong>{dayOneDate}</strong>
<br />
{label}
</TimelineLabel>
Expand All @@ -104,7 +117,7 @@ export const TimelineColumn = ({ hackathonStart, duration, numCols }) => {
return (
<TimelineBlock key={i}>
<TimelineLabel hourOffset={i}>
<strong>November 19th, 2023</strong>
<strong>{dayTwoDate}</strong>
<br />
{label}
</TimelineLabel>
Expand Down
8 changes: 4 additions & 4 deletions src/containers/Schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default () => {

useEffect(() => {
const unsubscribe = livesiteDocRef.onSnapshot(doc => {
const d = doc.data()
if (d) {
setStart(new Date(d.hackathonStart))
setEnd(new Date(d.hackathonEnd))
const data = doc.data()
if (data) {
setStart(new Date(data.hackathonStart))
setEnd(new Date(data.hackathonEnd))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small variable naming change, unrelated

}
})
return unsubscribe
Expand Down
Loading