From 5a1b3af9b0cfef5194b5caf863c4771449f021fd Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sat, 16 Dec 2017 20:23:22 +0000 Subject: [PATCH] Calendar: fix the unnecessary recration of closures. --- src/components/Calendar.tsx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/Calendar.tsx b/src/components/Calendar.tsx index 371b4af..2b98fe0 100644 --- a/src/components/Calendar.tsx +++ b/src/components/Calendar.tsx @@ -9,6 +9,19 @@ import { EventType } from '../pim-types'; moment.locale('en-gb'); BigCalendar.momentLocalizer(moment); +function eventPropGetter(event: EventType) { + return { + style: { + backgroundColor: event.color, + } + }; +} + +function agendaHeaderFormat(date: {start: Date, end: Date}, culture: string, localizer: any) { + const format = 'll'; + return localizer.format(date.start, format) + ' - ' + localizer.format(date.end, format); +} + class Calendar extends React.PureComponent { state: { currentDate?: Date; @@ -25,19 +38,6 @@ class Calendar extends React.PureComponent { } render() { - function eventPropGetter(event: EventType) { - return { - style: { - backgroundColor: event.color, - } - }; - } - - function agendaHeaderFormat(date: {start: Date, end: Date}, culture: string, localizer: any) { - const format = 'll'; - return localizer.format(date.start, format) + ' - ' + localizer.format(date.end, format); - } - return (