Skip to content

Commit 3736650

Browse files
committed
fixup! Remove unneeded parameters
Move calculations to upper level for performance
1 parent 031f72d commit 3736650

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/datetime/DaysView.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export default class DaysView extends React.Component {
5353

5454
renderDays() {
5555
const date = this.props.viewDate;
56+
const startOfMonth = date.clone().startOf('month');
57+
const endOfMonth = date.clone().endOf('month');
5658

5759
// We need 42 days in 6 rows
5860
// starting in the last week of the previous month
@@ -66,7 +68,7 @@ export default class DaysView extends React.Component {
6668

6769
while ( startDate.isBefore( endDate ) ) {
6870
let row = getRow( rows, i++ );
69-
row.push( this.renderDay( startDate ) );
71+
row.push( this.renderDay( startDate, startOfMonth, endOfMonth ) );
7072
startDate.add( 1, 'd' );
7173
}
7274

@@ -75,9 +77,7 @@ export default class DaysView extends React.Component {
7577
));
7678
}
7779

78-
renderDay( date ) {
79-
const startOfMonth = this.props.viewDate.clone().startOf('month');
80-
const endOfMonth = this.props.viewDate.clone().endOf('month');
80+
renderDay( date, startOfMonth, endOfMonth ) {
8181
let selectedDate = this.props.selectedDate;
8282

8383
let dayProps = {

0 commit comments

Comments
 (0)