This commit is contained in:
Sam 2018-07-29 12:06:36 +02:00
parent d37db4a714
commit 928981c627
2 changed files with 16 additions and 16 deletions

View File

@ -13,7 +13,7 @@ const getStartAndEndMonth = date => {
const monthEnd = dateFns.endOfMonth(date)
return {
start: dateFns.startOfWeek(monthStart),
end: dateFns.endOfWeek(monthEnd),
end: dateFns.endOfWeek(monthEnd),
}
}
@ -49,10 +49,10 @@ class Calendar extends React.Component {
</span>
</div>
<div className="col col-end" onClick={() => this.handleNextMonth()}>
<i
className="fa fa-chevron-right"
aria-hidden="true"
/>
<i
className="fa fa-chevron-right"
aria-hidden="true"
/>
</div>
</div>
)
@ -129,7 +129,7 @@ class Calendar extends React.Component {
recordsLabels.filter(
r => r.record_type === rec.record_type
)[0].label
}`)}
}`)}
/>
</sup>
)}
@ -150,7 +150,7 @@ class Calendar extends React.Component {
return <div className="body">{rows}</div>
}
updateStateDate (calendarDate) {
updateStateDate(calendarDate) {
const { start, end } = getStartAndEndMonth(calendarDate)
this.setState({
currentMonth: calendarDate,
@ -160,12 +160,12 @@ class Calendar extends React.Component {
this.props.loadMonthActivities(start, end)
}
handleNextMonth () {
handleNextMonth() {
const calendarDate = dateFns.addMonths(this.state.currentMonth, 1)
this.updateStateDate(calendarDate)
}
handlePrevMonth () {
handlePrevMonth() {
const calendarDate = dateFns.subMonths(this.state.currentMonth, 1)
this.updateStateDate(calendarDate)
}

View File

@ -22,10 +22,10 @@ export const isLoggedIn = () => !!window.localStorage.authToken
export const generateIds = arr => {
let i = 0
return arr.map(val => {
const obj = { id: i, value: val }
i++
return obj
})
const obj = { id: i, value: val }
i++
return obj
})
}
@ -124,9 +124,9 @@ export const formatRecord = (record, tz) => {
}
export const formatDuration = seconds => {
let newDate = new Date(0)
newDate = subHours(newDate.setSeconds(seconds), 1)
return newDate.getTime()
let newDate = new Date(0)
newDate = subHours(newDate.setSeconds(seconds), 1)
return newDate.getTime()
}
export const formatChartData = chartData => {