diff --git a/src/components/calendar/calendar-header-nav.jsx b/src/components/calendar/calendar-header-nav.jsx index 8d3557c1f..d6b6ae741 100644 --- a/src/components/calendar/calendar-header-nav.jsx +++ b/src/components/calendar/calendar-header-nav.jsx @@ -2,7 +2,7 @@ import { Link } from 'react-router'; import parse from 'date-fns/parse'; import format from 'date-fns/format'; -import { MIN_DATE, MAX_DATE } from '../../utils/calendar-utils'; +import { MAX_DATE } from '../../utils/calendar-utils'; import styles from './calendar.module.scss'; @@ -25,8 +25,13 @@ function CalendarHeaderNav(props) { currentDate: currentDateString, nextDate: nextDateString, previousDate: previousDateString, + createdAt, } = props; + const createdAtDate = new Date(Number(createdAt)); + const minYear = createdAtDate.getFullYear(); + const MIN_DATE = new Date(minYear, 0, 1); + const currentDate = parseDateString(currentDateString); const nextDate = nextDateString ? parseDateString(nextDateString) : null; const previousDate = previousDateString ? parseDateString(previousDateString) : null; diff --git a/src/components/calendar/calendar-year.jsx b/src/components/calendar/calendar-year.jsx index 4fc85f959..69dccd66e 100644 --- a/src/components/calendar/calendar-year.jsx +++ b/src/components/calendar/calendar-year.jsx @@ -49,6 +49,7 @@ function CalendarYear(props) { currentDate={`${yearAsInt}-01-01`} previousDate={`${yearAsInt - 1}-01-01`} nextDate={`${yearAsInt + 1}-01-01`} + createdAt={user.createdAt} /> {calendarDaysMap ? ( diff --git a/src/index.jsx b/src/index.jsx index f8c3fed06..c1b6710b6 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -33,7 +33,6 @@ import CalendarMonth from './components/calendar/calendar-month'; import CalendarDate from './components/calendar/calendar-date'; import SignupByInvitation from './components/signup-by-invitation'; import { settingsRoute } from './components/settings/routes'; -import { CALENDAR_START_YEAR } from './utils/calendar-utils'; Sentry.init({ dsn: CONFIG.sentry.publicDSN, @@ -428,7 +427,7 @@ function isMemoriesPath({ params: { userName, from } }) { const isValidCalendarYear = (year) => { const yearAsInt = parseInt(year, 10); - return yearAsInt >= CALENDAR_START_YEAR && yearAsInt <= thisYear; + return yearAsInt <= thisYear; }; const isValidMonth = (month) => { diff --git a/src/utils/calendar-utils.js b/src/utils/calendar-utils.js index d737a35d7..e62d1deb4 100644 --- a/src/utils/calendar-utils.js +++ b/src/utils/calendar-utils.js @@ -1,6 +1,4 @@ const now = new Date(); -export const CALENDAR_START_YEAR = 2000; -export const MIN_DATE = new Date(CALENDAR_START_YEAR, 0, 1); export const MAX_DATE = new Date(now.getFullYear(), 11, 31); export const monthNames = [