Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bug where appointments can appear outside the calendar #1204

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed bug where appointments can appear outside the calendar
  • Loading branch information
NathanBP committed Feb 1, 2019

Verified

This commit was signed with the committer’s verified signature.
sanjayankur31 Ankur Sinha
commit e8b9ebb02d3e255abc7353148fa974a0e41b1a83
1 change: 1 addition & 0 deletions examples/App.js
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ const EXAMPLES = {
customView: 'Custom Calendar Views',
resource: 'Resource Scheduling',
dnd: 'Addon: Drag and drop',
dndresource: 'Resource Drag and drop',
}

const DEFAULT_EXAMPLE = 'basic'
15 changes: 15 additions & 0 deletions examples/demos/dndresource.js
Original file line number Diff line number Diff line change
@@ -28,13 +28,27 @@ const events = [
end: new Date(2018, 0, 29, 12, 30, 0),
resourceId: 3,
},
{
id: 10,
title: 'Board meeting',
start: new Date(2018, 0, 30, 23, 0, 0),
end: new Date(2018, 0, 30, 23, 59, 0),
resourceId: 1,
},
{
id: 11,
title: 'Birthday Party',
start: new Date(2018, 0, 30, 7, 0, 0),
end: new Date(2018, 0, 30, 10, 30, 0),
resourceId: 4,
},
{
id: 12,
title: 'Board meeting',
start: new Date(2018, 0, 29, 23, 59, 0),
end: new Date(2018, 0, 30, 13, 0, 0),
resourceId: 1,
},
]

const resourceMap = [
@@ -103,6 +117,7 @@ class Dnd extends React.Component {
resourceTitleAccessor="resourceTitle"
onEventResize={this.resizeEvent}
defaultView="day"
showMultiDayTimes={true}
defaultDate={new Date(2018, 0, 29)}
/>
)
2 changes: 1 addition & 1 deletion src/utils/TimeSlots.js
Original file line number Diff line number Diff line change
@@ -130,7 +130,7 @@ export function getSlotMetrics({ min: start, max: end, step, timeslots }) {

const rangeStartMin = positionFromDate(rangeStart)
const rangeEndMin = positionFromDate(rangeEnd)
const top = (rangeStartMin / (step * numSlots)) * 100
const top = (rangeStartMin / (step * numSlots)) * 98

return {
top,