diff --git a/src/components/screens/Month/Month.js b/src/components/screens/Month/Month.js index 73ccbe2..05d7fc7 100644 --- a/src/components/screens/Month/Month.js +++ b/src/components/screens/Month/Month.js @@ -1,7 +1,9 @@ import React, { Component } from "react"; +import { Link } from "react-router-dom"; import styled from "@emotion/styled"; import { isAfter, + isThisYear, format, addMonths, subMonths, @@ -42,9 +44,32 @@ class Month extends Component { } = this.props; const currentDay = new Date(year, month - 1); + // include all months unless it's this year + let dayIndexesToInclude = 31; + if (isThisYear(currentDay)) { + dayIndexesToInclude = new Date().getDate(); + } + let yearCards = []; for (let i = 0; i < getDaysInMonth(currentDay); i++) { - yearCards.push({i + 1}); + const isDisabled = dayIndexesToInclude <= i; + if (isDisabled) { + yearCards.push( + + {i + 1} + + ); + } else { + yearCards.push( + + {i + 1} + + ); + } } return (