Skip to content

Commit

Permalink
Merge pull request #20 from smauer/master
Browse files Browse the repository at this point in the history
Fix date ranges/navigation for reports
  • Loading branch information
ayastreb authored Nov 11, 2018
2 parents 140bd3d + 1aa3cdd commit f53fba3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/entities/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ export default Report
function dateRange(date, timespan) {
const start = timespan === TIMESPAN_YEARLY ? startOfYear : startOfMonth
const end = timespan === TIMESPAN_YEARLY ? endOfYear : endOfMonth
let tempDate = new Date(date);
tempDate.setDate(tempDate.getDate()+1);
return {
start: toUtcTimestamp(start(date)),
end: toUtcTimestamp(end(date))
start: toUtcTimestamp(start(tempDate)),
end: toUtcTimestamp(end(tempDate))
}
}
4 changes: 3 additions & 1 deletion src/selectors/ui/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import Report from '../../entities/Report'

export const getReport = state => state.ui.report
export const getTimespanLabel = state => {
let startdate = new Date(state.ui.report.date.start);
startdate.setDate(startdate.getDate()+1);
return Report.timespanLabel(
state.ui.report.date.start,
startdate,
state.ui.report.timespan
)
}

0 comments on commit f53fba3

Please sign in to comment.