diff --git a/src/renderer/components/elements/sidebar/calendar-nav/CalendarNav.tsx b/src/renderer/components/elements/sidebar/calendar-nav/CalendarNav.tsx index 07ed173b..dae58f57 100644 --- a/src/renderer/components/elements/sidebar/calendar-nav/CalendarNav.tsx +++ b/src/renderer/components/elements/sidebar/calendar-nav/CalendarNav.tsx @@ -4,13 +4,13 @@ import { Moment } from "moment"; import React, { ReactElement } from "react"; import { MAX_DATE, MIN_DATE } from "../../../../constants"; -import { createDate, parseDate, toMonthYear } from "../../../../utils/dateFormat"; +import { createDate, toMonthYear } from "../../../../utils/dateFormat"; import { translations } from "../../../../utils/i18n"; import { iconProps } from "../../../../utils/icons"; export interface StateProps { allowFutureEntries: boolean; - monthSelected: Moment; + dateSelected: Moment; } export interface DispatchProps { @@ -23,7 +23,7 @@ type Props = StateProps & DispatchProps; export default function CalendarNav(props: Props): ReactElement { const { allowFutureEntries, - monthSelected, + dateSelected, setMonthSelectedNext, setMonthSelectedPrevious, } = props; @@ -32,10 +32,10 @@ export default function CalendarNav(props: Props): ReactElement { // Check if buttons for switching to previous/next month should be enabled. Determined based on // the min/max dates and whether future diary entries are allowed - const month = parseDate(monthSelected); - const canClickPrev = month.isAfter(MIN_DATE, "month"); + const canClickPrev = dateSelected.isAfter(MIN_DATE, "month"); const canClickNext = - month.isBefore(MAX_DATE, "month") && (allowFutureEntries || month.isBefore(today, "month")); + dateSelected.isBefore(MAX_DATE, "month") && + (allowFutureEntries || dateSelected.isBefore(today, "month")); return (
@@ -47,7 +47,7 @@ export default function CalendarNav(props: Props): ReactElement { > -

{toMonthYear(month)}

+

{toMonthYear(dateSelected)}