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

View File

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