Skip to content

Commit

Permalink
Merge pull request #1910 from croraf/fix_date_range_select
Browse files Browse the repository at this point in the history
[Create event] fix end date on slot selection
  • Loading branch information
pietrofxq authored May 27, 2021
2 parents a26e933 + 2345133 commit 2148e86
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/Month.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,14 @@ class MonthView extends React.Component {

slots.sort((a, b) => +a - +b)

const start = new Date(slots[0])
const end = new Date(slots[slots.length - 1])
end.setDate(slots[slots.length - 1].getDate() + 1)

notify(this.props.onSelectSlot, {
slots,
start: slots[0],
end: slots[slots.length - 1],
start,
end,
action: slotInfo.action,
bounds: slotInfo.bounds,
box: slotInfo.box,
Expand Down
9 changes: 7 additions & 2 deletions src/TimeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,15 @@ export default class TimeGrid extends Component {

handleSelectAllDaySlot = (slots, slotInfo) => {
const { onSelectSlot } = this.props

const start = new Date(slots[0])
const end = new Date(slots[slots.length - 1])
end.setDate(slots[slots.length - 1].getDate() + 1)

notify(onSelectSlot, {
slots,
start: slots[0],
end: slots[slots.length - 1],
start,
end,
action: slotInfo.action,
resourceId: slotInfo.resourceId,
})
Expand Down

0 comments on commit 2148e86

Please sign in to comment.